Upgrade to Pro — share decks privately, control downloads, hide ads and more …

スマホゲームを作ったよ

いも
November 19, 2016

 スマホゲームを作ったよ

初めてリリースしたiOSアプリの紹介と、マルチシーンエディットの活用事例です

いも

November 19, 2016
Tweet

More Decks by いも

Other Decks in Programming

Transcript

  1. )VNBO$POUSPM6*γʔϯ w ϓϨΠϠʔ σΠϒ ͕͍Δ w Ծ૝ίϯτϩʔϥ΋͜͜ w ୯ମͰ΋ಈ͔ͤΔ w

    3PPNͱ͜ͷγʔϯΛॏͶΔͱɺ෦ ԰୯ҐͰಈ࡞֬ೝͰ͖Δ w γʔϯ௥Ճ͚ͩͳͷͰσβΠφ୯ମ Ͱ࡞ۀ͠΍͍͢
  2. .BJO(BNFγʔϯ w ࣮ࡍͷήʔϜϑϩʔΛ؅ཧ͢Δ w ήʔϜͷΠϕϯτਐߦ؅ཧ w ෦԰ͷಈతಡΈࠐΈɺ੾Γସ͑ w #(.΋͜͜ w

    .BJO(BNF͕࠷ॳʹಡΈࠐ·Εɺॳ ظԽॲཧͰ)VNBO$POUSPM6*ɺ3PPN Λ௥Ճ͍ͯ͘͠ ը૾͕ͳ͍ͨΊՄѪ͍ೣΛ͓ૹΓ͍ͯ͠·͢
  3. ͋Δఔ౓ϧʔϧ෇͚ͨϥϯμϜ w׬શͳϥϯμϜ͸σβΠϯ͕ݫ͍͠ w෦԰ʹଐੑΛ͚ͭΔ wඞਢͳ෦԰ɺඞਢͰͳ͍෦԰ w)VC &WFOUҎ֎͸̍ݸ͚ͩඞਢ w)VC͸̍ݸҎ্ w&WFOU͸̌ݸҎ্ public enum

    RoomType
 {
 Start, // ։࢝஍఺
 Locker, // ϩοΧʔϧʔϜ
 Timecard, // λΠϜΧʔυ෦԰
 President, // ࣾ௕ࣨ
 Exit, // ඇৗޱ
 Goal, // ΰʔϧ Hub, // ઀ଓ෦԰ (υΞ͸3ʙ4ͭ)
 Event // Πϕϯτ෦԰
 }

  4. ࢖༻͢Δ෦԰ͷબ୒ ؆ུԽͨ͠΋ͷ private List<RoomProperty> BuildRoomsProperties(int count) { // ෦԰ͷScriptableObjectΛશ෦औΔ var

    properties = Resources.LoadAll<RoomProperty>("Rooms").ToList(); // ඞཁͳ෦԰ଐੑΛఆٛ RoomType[] requiredRoomType = { RoomType.Start, RoomType.Locker, RoomType.Timecard, RoomType.President, RoomType.Exit, RoomType.Goal }; // ༨Γ͸HubଐੑͰຒΊΔ List<RoomType> hubs = Enumerable.Repeat(RoomType.Hub, count - requiredRoomType.Length).ToList(); // Α͠ͳʹϥϯμϜʹऔΓग़ͯ͠ฦ͢ return hubs.AddRange(requiredRoomType.ToList()) .Select(t => GetRandomRoomProperty(properties, t)) .ToList(); }
  5. ෦԰ͱυΞͷΫϥεఆٛ #"% public class RoomBehaviour : MonoBehaviour { // ෦԰৘ใ

    public RoomProperty roomProperty; // ෦԰ʹ͋ΔυΞୡ public List<DoorBehaviour> doors; } public class DoorBehaviour : MonoBehaviour { // ܨ͕͍ͬͯΔυΞ public DoorBehaviour target; }
  6. σʔλΫϥεͱ#FIBWJPVSʹ෼͚Δ public class Room { private RoomProperty roomProperty; public List<Door>

    doors; public List<Item> items; } public class Door { private Room parentRoom; public Door target; }
  7. σʔλΫϥεͱ#FIBWJPVSʹ෼͚Δ public class RoomBehaviour : MonoBehaviour { public Room roomData;

    public List<DoorBehaviour> doors; public List<ItemBoxBehaviour> itemBoxes; } public class DoorBehaviour : MonoBehaviour { public Door doorData; }
  8. ੾Γସ͑ॲཧ ؆ུԽ public void MoveRoom(Door door) { var target =

    door.target; SceneManager.sceneLoaded += (scene, mode) => { var root = scene.GetRootGameObjects().First() .GetComponent<RoomBehaviour>(); root.SetupRoomData(target.room); SceneManager.UnloadScene(door.room.name); }; SceneManager.LoadSceneAsync(target.room.name, LoadSceneMode.Additive); }
  9. ੾Γସ͑ॲཧ ؆ུԽ public void MoveRoom(Door door) { var target =

    door.target; SceneManager.sceneLoaded += (scene, mode) => { var root = scene.GetRootGameObjects().First() .GetComponent<RoomBehaviour>(); root.SetupRoomData(target.room); SceneManager.UnloadScene(door.room.name); }; SceneManager.LoadSceneAsync(target.room.name, LoadSceneMode.Additive); } ৽͍͠෦԰ΛಡΈࠐΉ
  10. ੾Γସ͑ॲཧ ؆ུԽ public void MoveRoom(Door door) { var target =

    door.target; SceneManager.sceneLoaded += (scene, mode) => { var root = scene.GetRootGameObjects().First() .GetComponent<RoomBehaviour>(); root.SetupRoomData(target.room); SceneManager.UnloadScene(door.room.name); }; SceneManager.LoadSceneAsync(target.room.name, LoadSceneMode.Additive); } ෦԰ʹݱࡏͷ৘ใΛ༩͑Δ
  11. ੾Γସ͑ॲཧ ؆ུԽ public void MoveRoom(Door door) { var target =

    door.target; SceneManager.sceneLoaded += (scene, mode) => { var root = scene.GetRootGameObjects().First() .GetComponent<RoomBehaviour>(); root.SetupRoomData(target.room); SceneManager.UnloadScene(door.room.name); }; SceneManager.LoadSceneAsync(target.room.name, LoadSceneMode.Additive); } ݹ͍෦԰ͷ࡟আ
  12. 6OJ3Yͩͱ৭ʑָ public void MoveRoom(Door door) { var target = door.target;

    // ઀ଓઌͷυΞ͕͋ΔγʔϯΛϩʔυ SceneManager.LoadSceneAsync(target.room.name, LoadSceneMode.Additive) .AsObservable() .Select(__ => SceneManager.GetSceneByName(target.room.name)) .DelayFrame(1) .Subscribe(scene => { // ηοτΞοϓӠʑ }); }
  13. ࠷ޙʹ ͜Μͳ1SFGBC͸γʔϯʹͯ͠ྑ͍ͷͰ͸ͳ͍͔ʁͱ͍͏ײ૝ w ෳ਺ͷผͷ(BNF0CKFDU͕ࠞͬͯ͟Δ w (6*Ͱͷฤू࡞ۀ͕ଟ͍ w ̍ՕॴͰ͔͠࢖ͬͯͳ͍ w ୯ମͰ΋ػೳ͢Δ


    ֎෦ͷΦϒδΣΫτʹґଘ͠ͳ͍ σΠϒͷྫɿ w ෦԰͸κϯϏɾΞΠςϜɾصͳͲ͍ͬͺ͍͋Δ w ෦԰ͷ഑ஔͳͲ͸සൟʹߋ৽͢Δ w ׌ͭ࠶ར༻͢Δ͜ͱ͸ͳ͍ ద੾ʹ੾Γ෼͚ͯ޾ͤʹ։ൃ͍ͨ͠