void HitWall(MapRoomController room, string direction) { if (buttonCooldown <= 0) { buttonCooldown = 0.5f; GameManager.Instance.CameraShake(0.3f); if (room == null) { GameManager.Instance.HitWall(false); } else { switch (direction) { case "Left": activeRoom.SetWallType("Left", MapRoomController.Wall.Passage); room.SetWallType("Right", MapRoomController.Wall.Passage); break; case "Up": activeRoom.SetWallType("Up", MapRoomController.Wall.Passage); room.SetWallType("Down", MapRoomController.Wall.Passage); break; case "Right": activeRoom.SetWallType("Right", MapRoomController.Wall.Passage); room.SetWallType("Left", MapRoomController.Wall.Passage); break; case "Down": activeRoom.SetWallType("Down", MapRoomController.Wall.Passage); room.SetWallType("Up", MapRoomController.Wall.Passage); break; } GameManager.Instance.HitWall(true); activeRoom.UpdateNeighbours(); SetButtonsTypes(); } } }
void SetActiveRoom(GameObject room) { MapRoomController roomController = room.GetComponent <MapRoomController>(); foreach (GameObject _room in rooms) { MapRoomController _roomController = _room.GetComponent <MapRoomController>(); _roomController.ActiveRoom(false); if (_roomController == roomController) { activeRoom = _roomController; _roomController.ActiveRoom(true); } } //set buttons types SetButtonsTypes(); roomController.ShowRoom(true); roomController.ShowPassages(true); GetRoomNeighbours(roomController); roomController.UpdateNeighbours(); activeRoom.SpawnChest(); }