コード例 #1
0
    public Grid GenerateFromDoor(RoomDoor door, Vector2Int pos)
    {
        Grid       room;
        Vector2Int?roomPos;
        int        length = 1;
        Tilemap    tmp    = _grid.GetComponentsInChildren <Tilemap>().FirstOrDefault(t => t.gameObject.name == "Ground");

        do
        {
            for (int i = 0; i < PathSize; i++)
            {
                pos = Direction.GoAuto(new Vector2Int(pos.x, pos.y), 1, door.Dir);
                length++;
            }
            if (tmp && !TestCol(tmp, pos, new Vector2Int(1, 1)))
            {
                return(null);
            }
            room    = AvailableRooms[Random.Range(0, AvailableRooms.Length)];
            roomPos = CanInsertRoom(room.GetComponent <Room>(), new Vector2Int(pos.x, pos.y), door.Dir);
        } while (roomPos == null);

        DrawPath(pos, length, room.GetComponent <Room>().From);
        room.GetComponent <Room>().Pos = roomPos.GetValueOrDefault();
        return(room);
    }
コード例 #2
0
    public void ChangeRoomFrom(RoomDoor door)
    {
        // 房間被鎖住了,不切換
        if (door.BelongRoom.IsLocked)
        {
            return;
        }

        // 沒有下一個門,不切換
        if (door.NextDoor == null)
        {
            return;
        }

        // 切換中,不切換
        if (gameCamera.IsMoving())
        {
            return;
        }

        // 先把玩家移到下一個門的位置
        player.transform.position = door.NextDoor.transform.position;
        // 然後切換攝影機到下一個房間的位置
        currentRoom = door.NextDoor.BelongRoom;
        gameCamera.MoveTo(currentRoom.transform.position);
        //啟動房間
        currentRoom.RoomStart();
    }
コード例 #3
0
ファイル: MapState.cs プロジェクト: virtuoushub/game-off-2016
    public MapState Apply(ApplicableOperator op)
    {
        this.applicableConnections.Remove(op);
        RoomDoor roomDoor  = op.sourceRoomDoor;
        RoomDoor otherRoom = op.connectionRoomDoor;

        openDoors.Remove(roomDoor);
        lastDoor = roomDoor;
        otherRoom.room.roomId = rooms.Count;
        MapState newState = new MapState();

        foreach (Room room in rooms)
        {
            if (room.roomId == roomDoor.room.roomId)
            {
                Room clonedRoom = roomDoor.room.clone();
                Door clonedDoor = clonedRoom.GetDoor(roomDoor.door.doorId);
                Room.ConnectDoors(clonedRoom, clonedDoor, otherRoom.room, otherRoom.door);
                newState.AddRoom(clonedRoom);
            }
            else
            {
                newState.AddRoom(room.clone());
            }
        }
        newState.AddRoom(otherRoom.room);
        return(newState);
    }
コード例 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            RoomDoor roomDoor = db.RoomDoors.Find(id);

            db.RoomDoors.Remove(roomDoor);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #5
0
 public void Temp_OnPlayerTouchRoomDoor(RoomDoor rd)
 {
     if (Temp_IsTrialEnd(rd.MyRoom))
     {
         PlayerTypes playerType = Temp_GetTrialEndPlayerType(rd.MyRoom);
         charLineup.AddPlayerType(playerType);
     }
 }
コード例 #6
0
 bool isRoomApplicable(RoomDoor roomDoor, Room newRoom)
 {
     if (actualState.RoomCount() + actualState.OpenDoorCount() + newRoom.doors.Count - 1 > roomLimit)
     {
         return(false);
     }
     return(true);
 }
コード例 #7
0
    /// <summary>
    /// Removes the room from the overall dictionary, sets all door parents and destroys the room object
    /// </summary>
    /// <param name="room">Room to destroy</param>
    /// <param name="roomId">Unique ID of the room</param>
    private void HandleRoomDespawning(BaseRoom room, Guid roomId)
    {
        // Remove the room from overall dictionary
        roomDictionary.Remove(roomId);

        Dictionary <Vector2, RoomDoor>  roomDoors        = room.roomDoors;
        Dictionary <RoomDoor, BaseRoom> neighboringRooms = new Dictionary <RoomDoor, BaseRoom>();

        // Enumerate through the room's doors
        foreach (KeyValuePair <Vector2, RoomDoor> kvp in roomDoors)
        {
            RoomDoor door = kvp.Value;

            Vector2 doorExit = room.GetDoorExit(door);

            // Skip doors that don't have another room connected
            if (!roomLocations.ContainsKey(doorExit))
            {
                continue;
            }

            BaseRoom exitRoom = roomLocations[doorExit];

            neighboringRooms.Add(door, exitRoom);
        }

        // Enumerate through all doors
        foreach (KeyValuePair <RoomDoor, BaseRoom> kvp in neighboringRooms)
        {
            BaseRoom neighboringRoom = kvp.Value;

            if (neighboringRoom == null)
            {
                continue;
            }

            RoomDoor currentDoor = kvp.Key;

            Vector2 setLocation = currentDoor.GetLocation();

            // Change connected door's parent to their other connected room so they don't get destroyed
            currentDoor.transform.SetParent(neighboringRoom.transform);
        }

        // Loop through all the tile locations for the room to be destroyed
        for (int i = 0; i < room.roomLocations.Count; ++i)
        {
            Vector2 location = room.roomLocations[i];
            if (roomLocations.ContainsKey(location))
            {
                // Remove the tile location from the overall used locations
                roomLocations.Remove(location);
            }
        }

        // Finally destroy the room object
        Destroy(room.gameObject);
    }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "Id,Door")] RoomDoor roomDoor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(roomDoor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(roomDoor));
 }
コード例 #9
0
ファイル: DoorGizmo.cs プロジェクト: Sven-dev/Rpg-project
    // Use this for initialization
    void Start()
    {
        if (Application.isEditor)
        {
            Boxcollider = GetComponent <BoxCollider2D>();

            DoorCollor = new Color(0, 1, 0, 0.5f);
            Door       = GetComponent <RoomDoor>();
        }
    }
コード例 #10
0
        public ActionResult Create([Bind(Include = "Id,Door")] RoomDoor roomDoor)
        {
            if (ModelState.IsValid)
            {
                db.RoomDoors.Add(roomDoor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(roomDoor));
        }
コード例 #11
0
ファイル: RoomLoop.cs プロジェクト: ByteNybbler/NotTheFace
    private void CreateDoor(RoomSpawnData room, Transform doorParent, int sign = 1)
    {
        GameObject door = Instantiate(prefabDoor, doorParent);

        door.transform.position = transform.position + GetHalfRoomWidthVector(room) * sign;
        Vector3 newScale = door.transform.localScale;

        newScale.x *= -1.0f * UtilMath.Sign(roomNumber % roomOrder.Length == 1) * sign;
        door.transform.localScale = newScale;
        latestDoor = door.GetComponent <RoomDoor>();
    }
コード例 #12
0
    internal Vector2 GetDoorEntrance(RoomDoor door)
    {
        foreach (KeyValuePair <Vector2, BaseRoom> kvp in door.connectedRooms)
        {
            if (kvp.Value == this)
            {
                return(kvp.Key);
            }
        }

        return(Vector2.zero);
    }
コード例 #13
0
 //Loads the room and replace the player at specified door spawn.
 private void SwitchToRoom(Room room, RoomDoor door)
 {
     LoadRoom(room);
     //reset position
     _mainPlayer.transform.position  = new Vector3(door.RoomSpawn.x, _mainPlayer.transform.position.y, door.RoomSpawn.y);
     _mainPlayer.transform.position += _currentRoom.transform.position;
     //reset camera
     _mainPlayerCamera.CameraTarget = _mainPlayer.transform.position;
     _mainPlayerCamera.ResetCameraPos();
     //hud
     HudManager.OnRoomEnter(room.RoomName);
 }
コード例 #14
0
    private void CreateWalls()
    {
        List <Vector2> doorExits = GetDoorExits();

        foreach (Vector2 tile in this.roomLocations)
        {
            List <Vector2> neighboringTiles = RoomGenerator.GetNeighboringTiles(tile);

            for (int i = 0; i < neighboringTiles.Count; ++i)
            {
                Vector2 neighboringTile = neighboringTiles[i];

                if (this.roomLocations.Contains(neighboringTile))
                {
                    continue;
                }

                Vector2 direction   = neighboringTile - tile;
                Vector2 setLocation = tile + (direction * 0.5f);

                if (this.roomDoors.ContainsKey(setLocation))
                {
                    continue;
                }

                if (RoomGenerator.roomLocations.ContainsKey(neighboringTile))
                {
                    BaseRoom neighboringRoom = RoomGenerator.roomLocations[neighboringTile];

                    if (neighboringRoom.roomDoors.ContainsKey(setLocation))
                    {
                        RoomDoor neighborDoor = neighboringRoom.roomDoors[setLocation];
                        this.roomDoors.Add(setLocation, neighborDoor);

                        continue;
                    }
                }

                // Create a wall
                GameObject obj = Instantiate(RoomGenerator.Instance?.roomWallPrefab, this.transform);

                // Rotate and position the wall
                obj.transform.rotation = Quaternion.Euler(0, 0, (direction.y != 0 ? 90 : 0));
                obj.transform.position = setLocation;
                // Adjust to player position
                obj.transform.position += new Vector3(0, 0, -5);

                this.roomWalls.Add(setLocation, obj);
            }
        }
    }
コード例 #15
0
        // GET: RoomDoors/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RoomDoor roomDoor = db.RoomDoors.Find(id);

            if (roomDoor == null)
            {
                return(HttpNotFound());
            }
            return(View(roomDoor));
        }
コード例 #16
0
    bool isDoorApplicable(RoomDoor roomDoor, Room otherRoom, Door otherDoor)
    {
        if (!Door.Opposite(roomDoor.door.position, otherDoor.position))
        {
            return(false);
        }
        Room cloneOther = otherRoom.clone();

        Room.ConnectDoors(roomDoor.room.clone(), roomDoor.door.clone(), cloneOther, otherDoor.clone());
        if (actualState.Overlaps(cloneOther))
        {
            return(false);
        }
        return(true);
    }
コード例 #17
0
 public void OnPlayerTouchRoomDoor(RoomDoor rd)
 {
     // TEMP TEST: If no Room to go to, open ClustSelect scene!
     if (string.IsNullOrEmpty(rd.RoomToKey))
     {
         OnPlayerExitRoom(rd.MyRoom);
         SceneHelper.OpenScene(SceneNames.ClustSelMap);
     }
     // Otherwise...
     else
     {
         // TEMP HACK: Tell CharSwapController, in case it's a Trial end.
         charSwapController.Temp_OnPlayerTouchRoomDoor(rd);
         GoToRoomDoorRoom(rd);
     }
 }
コード例 #18
0
    private void GoToRoomDoorRoom(RoomDoor rd)
    {
        // Register exiting the Room!
        OnPlayerExitRoom(rd.MyRoom);
        // Set the door we're gonna start at!
        dm.doorToID = rd.DoorToID;
        // Load the room!
        int      _worldIndex = rd.WorldToIndex == -1 ? rd.MyRoom.WorldIndex : rd.WorldToIndex; // Haven't defined worldToIndex? Stay in my world.
        RoomData rdTo        = dm.GetRoomData(_worldIndex, rd.RoomToKey, false);

        if (rdTo == null)   // Safety check.
        {
            Debug.LogWarning("RoomDoor can't go to RoomData; doesn't exist. World: " + _worldIndex + ", RoomKey: " + rd.RoomToKey);
        }
        else   // There IS a room to go to! Go!
        {
            StartGameAtRoom(rdTo);
        }
    }
コード例 #19
0
ファイル: Room.cs プロジェクト: FantinBibas/ggj2018
    public Vector2Int PosFromDoor(RoomDoor door, Vector2Int pos)
    {
        switch (door.Dir)
        {
        case Direction.to.SOUTH:
            return(new Vector2Int(pos.x - door.Pos, pos.y));

        case Direction.to.NORTH:
            return(new Vector2Int(pos.x - door.Pos, pos.y - Size.y + 1));

        case Direction.to.WEST:
            return(new Vector2Int(pos.x, pos.y - door.Pos));

        case Direction.to.EAST:
            return(new Vector2Int(pos.x - Size.x + 1, pos.y - door.Pos));

        default:
            return(pos);
        }
    }
コード例 #20
0
    private bool CheckForDoor()
    {
        var position = transform.position;
        var hit      = Physics2D.Raycast(position, character.transform.right, 1f, DoorLayerMask);

        Debug.DrawRay(position, character.transform.right, Color.red);

        if (hit)
        {
            var door = hit.transform.GetComponent <RoomDoor>();

            if (door != null)
            {
                actualDoor = door;
                return(true);
            }
        }

        return(false);
    }
コード例 #21
0
ファイル: Room.cs プロジェクト: FantinBibas/ggj2018
    public Vector2Int DoorPos(RoomDoor door)
    {
        switch (door.Dir)
        {
        case Direction.to.SOUTH:
            return(new Vector2Int(Pos.x + door.Pos, Pos.y));

        case Direction.to.NORTH:
            return(new Vector2Int(Pos.x + door.Pos, Pos.y + Size.y - 1));

        case Direction.to.WEST:
            return(new Vector2Int(Pos.x, Pos.y + door.Pos));

        case Direction.to.EAST:
            return(new Vector2Int(Pos.x + Size.x - 1, Pos.y + door.Pos));

        default:
            return(new Vector2Int(Pos.x, Pos.y));
        }
    }
コード例 #22
0
    private Vector3[] CalcDoorPoints(RoomDoor d)
    {
        Vector3[] points = { new Vector3(), new Vector3(), new Vector3(), new Vector3() };

        Vector3 roomPos = transform.position;

        switch (d.Side)
        {
        case ROOM_SIDE.UP:
            //Low points
            points[0] = new Vector3(roomPos.x + d.WallPos - d.DoorSize / 2, transform.position.y, roomPos.z + RoomBounds.y);
            points[3] = new Vector3(roomPos.x + d.WallPos + d.DoorSize / 2, transform.position.y, roomPos.z + RoomBounds.y);
            break;

        case ROOM_SIDE.DOWN:
            //Low points
            points[0] = new Vector3(roomPos.x + d.WallPos - d.DoorSize / 2, transform.position.y, roomPos.z);
            points[3] = new Vector3(roomPos.x + d.WallPos + d.DoorSize / 2, transform.position.y, roomPos.z);
            break;

        case ROOM_SIDE.LEFT:
            //Low points
            points[0] = new Vector3(roomPos.x, transform.position.y, roomPos.z + d.WallPos - d.DoorSize / 2);
            points[3] = new Vector3(roomPos.x, transform.position.y, roomPos.z + d.WallPos + d.DoorSize / 2);
            break;

        case ROOM_SIDE.RIGHT:
            //Low points
            points[0] = new Vector3(roomPos.x + RoomBounds.x, transform.position.y, roomPos.z + d.WallPos - d.DoorSize / 2);
            points[3] = new Vector3(roomPos.x + RoomBounds.x, transform.position.y, roomPos.z + d.WallPos + d.DoorSize / 2);
            break;

        default:
            break;
        }

        //High Points
        points[1] = points[0] + Vector3.up * _editorDoorHeight;
        points[2] = points[3] + Vector3.up * _editorDoorHeight;
        return(points);
    }
コード例 #23
0
    /// <summary>
    /// Creates a single room that should be connected to the given door
    /// </summary>
    /// <param name="door"></param>
    private static void CreateRoom(RoomDoor door, BaseRoom connectedRoom)
    {
        if (door == null || connectedRoom == null)
        {
            Debug.LogError("Given door or room is null!");
            return;
        }

        Vector2 doorExit = connectedRoom.GetDoorExit(door);
        // Get the first tile locations to start the recursive operation
        List <Vector2> firstTileLocations = GetOpenNeighboringTiles(doorExit);

        List <Vector2> roomTiles = new List <Vector2>
        {
            doorExit
        };

        UnityEngine.Random.InitState((int)DateTime.UtcNow.Ticks);

        // Loop through the first locations and start creating tiles
        foreach (Vector2 pos in firstTileLocations)
        {
            float cumulativeChance = Instance.additionalTileChance;

            roomTiles = RandomRoomLayoutRecursive(roomTiles, cumulativeChance, pos);
        }

        // When all room tiles have been found, instantiate the object
        BaseRoom newRoom = Instantiate(Instance?.baseRoomPrefab);

        newRoom.roomLocations = roomTiles;
        // Initialize the room after instantiation
        newRoom.InitRoom(door);

        door.connectedRooms[doorExit] = newRoom;

        PlaceRoom(newRoom);
    }
コード例 #24
0
    List <RoomDoor> GetApplicableConnections(RoomDoor openRoomDoor)
    {
        List <RoomDoor> applicableConnections = new List <RoomDoor> ();

        for (int i = 0; i < templates.Length; i++)
        {
            Room act = templates [i];
            if (isRoomApplicable(openRoomDoor, act))
            {
                Room actRoom = act.clone();
                foreach (Door door in actRoom.doors.Values)
                {
                    if (isDoorApplicable(openRoomDoor, actRoom, door))
                    {
//						Debug.Log ("Applicable room: [Room: " + actRoom.width + "x" + actRoom.height + ", Door: " + door.position + "]");
                        applicableConnections.Add(new RoomDoor(actRoom, door));
                    }
                }
            }
        }
        Shuffle(applicableConnections);
        return(applicableConnections);
    }
コード例 #25
0
    internal void InitRoom(RoomDoor createdFromDoor)
    {
        this.roomId = Guid.NewGuid();

        // Add the created room to the manager's list
        RoomGenerator.roomDictionary.Add(this.roomId, this);

        foreach (Vector2 pos in this.roomLocations)
        {
            // Create a primitive cube to display tile location
            GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Cube);
            obj.transform.SetParent(this.transform);
            obj.transform.localPosition = pos;

            if (RoomGenerator.Instance?.firstRoom == this)
            {
                obj.GetComponent <MeshRenderer>().material.color = Color.black;
            }
        }

        CreateDoors(createdFromDoor);
        CreateWalls();
    }
コード例 #26
0
ファイル: MapState.cs プロジェクト: virtuoushub/game-off-2016
 public void ReAddLastDoor()
 {
     openDoors.Add(lastDoor);
     lastDoor = null;
 }
コード例 #27
0
 public void SetDoorExit(RoomDoor door)
 {
     doorExit = door;
 }
コード例 #28
0
 public void SetDoorEntry(RoomDoor door)
 {
     doorEntry = door;
 }
コード例 #29
0
ファイル: DbInitializer.cs プロジェクト: LeoKnox/MvcRoom2
        public static void Initialize(DungeonContext context)
        {
            context.Database.EnsureCreated();

            if (context.Rooms.Any())
            {
                return;
            }

            var rooms = new Room[]
            {
                new Room {
                    RoomName = "Entry", Material = "Earth", Length = 5, Width = 5
                },
                new Room {
                    RoomName = "StorageA", Material = "Stone", Length = 3, Width = 7
                },
                new Room {
                    RoomName = "Dungeon1", Material = "Brick", Length = 5, Width = 3
                },
                new Room {
                    RoomName = "Dungeon2", Material = "Stone", Length = 4, Width = 4
                }
            };

            foreach (Room r in rooms)
            {
                context.Rooms.Add(r);
            }
            context.SaveChanges();

            var doors = new Door[]
            {
                new Door {
                    DoorID = 1, Type = "Wood", Location = 2
                },
                new Door {
                    DoorID = 8, Type = "Stone", Location = 4
                },
                new Door {
                    DoorID = 12, Type = "Stone", Location = 3
                },
                new Door {
                    DoorID = 11, Type = "Iron", Location = 2
                },
                new Door {
                    DoorID = 44, Type = "Wood", Location = 1
                }
            };

            foreach (Door d in doors)
            {
                context.Doors.Add(d);
            }
            context.SaveChanges();

            var roomdoors = new RoomDoor[]
            {
                new RoomDoor {
                    DoorID = 1, RoomId = 1, Side = Side.East
                },
                new RoomDoor {
                    DoorID = 8, RoomId = 2, Side = Side.North
                },
                new RoomDoor {
                    DoorID = 12, RoomId = 3, Side = Side.West
                },
                new RoomDoor {
                    DoorID = 11, RoomId = 4, Side = Side.North
                },
                new RoomDoor {
                    DoorID = 44, RoomId = 1, Side = Side.South
                }
            };

            foreach (RoomDoor s in roomdoors)
            {
                context.RoomDoors.Add(s);
            }
            context.SaveChanges();
        }
コード例 #30
0
ファイル: Room.cs プロジェクト: BATzerk/Unity-BounceMeister
    // ----------------------------------------------------------------
    //	Initialize
    // ----------------------------------------------------------------
    public void Initialize(GameController _gameControllerRef, Transform tf_world, RoomData _roomData)
    {
        gameControllerRef    = _gameControllerRef;
        MyRoomData           = _roomData;
        this.gameObject.name = MyRoomData.RoomKey;

        GameUtils.ParentAndReset(this.gameObject, tf_world);
        this.transform.localPosition = PosGlobal; // Position me!

        // Initialize channels!
        gateChannels = new GateChannel[5];
        for (int i = 0; i < gateChannels.Length; i++)
        {
            gateChannels[i] = new GateChannel(this, i);
        }

        // Instantiate my props!
        RoomData         rd  = MyRoomData;
        ResourcesHandler rh  = ResourcesHandler.Instance;
        int numProgressGates = 0; // for deteriming their indexes.
        int numVeils         = 0; // for determining their indexes.

        foreach (PropData propData in rd.allPropDatas)
        {
            System.Type pt = propData.GetType();
            if (false)
            {
            }
            // Enemies
            else if (pt == typeof(DweebData))
            {
                Dweeb newProp = Instantiate(rh.Dweeb).GetComponent <Dweeb>();
                newProp.Initialize(this, propData as DweebData);
            }
            // Grounds
            else if (pt == typeof(CrateData))
            {
                Crate newProp = Instantiate(rh.Crate).GetComponent <Crate>();
                newProp.Initialize(this, propData as CrateData);
            }
            else if (pt == typeof(DispGroundData))
            {
                DispGround newProp = Instantiate(rh.DispGround).GetComponent <DispGround>();
                newProp.Initialize(this, propData as DispGroundData);
            }
            else if (pt == typeof(GateData))
            {
                Gate newProp = Instantiate(rh.Gate).GetComponent <Gate>();
                newProp.Initialize(this, propData as GateData);
                gateChannels[newProp.ChannelID].AddGate(newProp);
            }
            else if (pt == typeof(ToggleGroundData))
            {
                ToggleGround newProp = Instantiate(rh.ToggleGround).GetComponent <ToggleGround>();
                newProp.Initialize(this, propData as ToggleGroundData);
            }
            else if (pt == typeof(PlatformData))
            {
                Platform newProp = Instantiate(rh.Platform).GetComponent <Platform>();
                newProp.Initialize(this, propData as PlatformData);
            }
            else if (pt == typeof(GroundData))
            {
                Ground newProp = Instantiate(rh.Ground).GetComponent <Ground>();
                newProp.Initialize(this, propData as GroundData);
            }
            // Everything else!
            else if (pt == typeof(BatteryData))
            {
                Battery newProp = Instantiate(rh.Battery).GetComponent <Battery>();
                newProp.Initialize(this, propData as BatteryData);
            }
            else if (pt == typeof(BuzzsawData))
            {
                Buzzsaw newProp = Instantiate(rh.Buzzsaw).GetComponent <Buzzsaw>();
                newProp.Initialize(this, propData as BuzzsawData);
            }
            else if (pt == typeof(CharBarrelData))
            {
                CharBarrel newProp = Instantiate(rh.CharBarrel).GetComponent <CharBarrel>();
                newProp.Initialize(this, propData as CharBarrelData, charBarrels.Count);
                charBarrels.Add(newProp);
            }
            else if (pt == typeof(CharUnlockOrbData))
            {
                CharUnlockOrb newProp = Instantiate(rh.CharUnlockOrb).GetComponent <CharUnlockOrb>();
                newProp.Initialize(this, propData as CharUnlockOrbData);
            }
            else if (pt == typeof(CameraBoundsData))
            {
                CameraBounds newProp = Instantiate(rh.CameraBounds).GetComponent <CameraBounds>();
                newProp.Initialize(this, propData as CameraBoundsData);
            }
            else if (pt == typeof(GateButtonData))
            {
                GateButton newProp = Instantiate(rh.GateButton).GetComponent <GateButton>();
                newProp.Initialize(this, propData as GateButtonData);
                gateChannels[newProp.ChannelID].AddButton(newProp);
            }
            else if (pt == typeof(GemData))
            {
                Gem newProp = Instantiate(rh.Gem).GetComponent <Gem>();
                newProp.Initialize(this, propData as GemData, gems.Count);
                gems.Add(newProp);
            }
            else if (pt == typeof(InfoSignData))
            {
                InfoSign newProp = Instantiate(rh.InfoSign).GetComponent <InfoSign>();
                newProp.Initialize(this, propData as InfoSignData);
            }
            else if (pt == typeof(LaserData))
            {
                Laser newProp = Instantiate(rh.Laser).GetComponent <Laser>();
                newProp.Initialize(this, propData as LaserData);
            }
            else if (pt == typeof(LiftData))
            {
                Lift newProp = Instantiate(rh.Lift).GetComponent <Lift>();
                newProp.Initialize(this, propData as LiftData);
            }
            else if (pt == typeof(PlayerStartData))
            {
                PlayerStart newProp = Instantiate(rh.PlayerStart).GetComponent <PlayerStart>();
                newProp.Initialize(this, propData as PlayerStartData);
            }
            else if (pt == typeof(ProgressGateData))
            {
                ProgressGate newProp = Instantiate(rh.ProgressGate).GetComponent <ProgressGate>();
                newProp.Initialize(this, propData as ProgressGateData, numProgressGates++);
            }
            else if (pt == typeof(RoomDoorData))
            {
                RoomDoor newProp = Instantiate(rh.RoomDoor).GetComponent <RoomDoor>();
                newProp.Initialize(this, propData as RoomDoorData);
            }
            else if (pt == typeof(SnackData))
            {
                Snack newProp = Instantiate(rh.Snack).GetComponent <Snack>();
                newProp.Initialize(this, propData as SnackData, snacks.Count);
                snacks.Add(newProp);
            }
            else if (pt == typeof(SpikesData))
            {
                Spikes newProp = Instantiate(rh.Spikes).GetComponent <Spikes>();
                newProp.Initialize(this, propData as SpikesData);
            }
            else if (pt == typeof(TurretData))
            {
                Turret newProp = Instantiate(rh.Turret).GetComponent <Turret>();
                newProp.Initialize(this, propData as TurretData);
            }
            else if (pt == typeof(VeilData))
            {
                Veil newProp = Instantiate(rh.Veil).GetComponent <Veil>();
                newProp.Initialize(this, propData as VeilData, numVeils++);
            }
            else
            {
                Debug.LogWarning("PropData not recognized: " + propData);
            }
        }

        AddHardcodedRoomElements();

        // For development, add bounds so we don't fall out of unconnected rooms!
        AutoAddInvisibounds();
        roomGizmos.Initialize(this);
        shutters.Initialize(this);
    }
コード例 #31
0
	public void CloseDoors(RoomDoor[] doors_)
	{
		for(int i = 0; i < doors_.Length; i++)
		{
			doors_[i].ChangeDoorState(false);
		}	
	}
コード例 #32
0
	public void OpenDoors(RoomDoor[] doors_)
	{
		for(int i = 0; i < doors_.Length; i++)
		{
			doors_[i].ChangeDoorState(true);
		}
	}