IEnumerator ManageRoomQueue() { yield return(new WaitForFixedUpdate()); while (RoomGeneration.spawncap < roomCap - 1) { if (roomQueue.Count > 0) { RoomGeneration thisRoom = roomQueue.Peek(); thisRoom.QueuedStart(); roomQueue.Dequeue(); } yield return(null); } //RoomGeneration[] rooms = FindObjectsOfType<RoomGeneration>(); foreach (RoomGeneration room in allRooms) { DoorGen[] doors = room.GetComponentsInChildren <DoorGen> (); foreach (DoorGen door in doors) { door.EndSpawningCheck(); roomQueue.Clear(); } } CheckAllActiveRooms(); Invoke("CheckAllActiveRooms", 0.25f); roomsLoaded = true; }
//grab this IEnumerator ActivateRoom(Transform player) { RoomManager.gameSetupComplete = false; RoomGeneration parentRoom = GetComponentInParent <RoomGeneration> (); parentRoom.SetActive(true); CameraController cam = FindObjectOfType <CameraController> (); cam.MoveCamera(transform.position); Vector3 playerStartPos = player.transform.position; BulletWeapon[] bullets = FindObjectsOfType <BulletWeapon> (); foreach (BulletWeapon bullet in bullets) { Destroy(bullet.gameObject); } float distance = Vector3.Distance(transform.position, player.position); float endDistance = Vector3.Distance(transform.position, player.position) - 1.5f; while (distance > endDistance) { player.transform.position = Vector3.MoveTowards(player.transform.position, transform.position, 2 * Time.deltaTime); distance = Vector3.Distance(transform.position, player.position); yield return(null); } RoomManager.gameSetupComplete = true; }
void LastDoorCheck() { if (doorLocation == DoorLoc.lowerRight) { RoomGeneration room = GetComponentInParent <RoomGeneration> (); room.DoorsLeft(); } }
private void OnTriggerExit2D(Collider2D collision) { if (collision.gameObject.name == "Player") { RoomGeneration parentRoom = GetComponentInParent <RoomGeneration> (); parentRoom.SetActive(false); } }
// Use this for initialization void Start() { roomManager = FindObjectOfType <RoomManager> (); roomGen = FindObjectOfType <RoomGeneration> (); LoadQuestStatus(); DeactivateAllQuests(); notifPanel = FindObjectOfType <NotificationsPanel>(); }
// Use this for initialization void Start() { firstTimeSetup = false; questReady = false; qController = FindObjectOfType <QuestController> (); containingRoom = GetComponentInParent <RoomGeneration> (); setupDone = false; droneUp = false; qMarked = QuestController.activeEvents[Random.Range(1, QuestController.activeEvents.Count)]; }
private bool IsThereAnOpenDoor(RoomGeneration room) { DoorGen[] walls = room.GetComponentsInChildren <DoorGen> (); DoorGen adjacentWall; switch (doorLocation) { case DoorLoc.top: adjacentWall = walls[(int)DoorLoc.bottom]; break; case DoorLoc.bottom: adjacentWall = walls[(int)DoorLoc.top]; break; case DoorLoc.upperLeft: adjacentWall = walls[(int)DoorLoc.lowerRight]; break; case DoorLoc.upperRight: adjacentWall = walls[(int)DoorLoc.lowerLeft]; break; case DoorLoc.lowerLeft: adjacentWall = walls[(int)DoorLoc.upperRight]; break; case DoorLoc.lowerRight: adjacentWall = walls[(int)DoorLoc.upperLeft]; break; default: adjacentWall = walls[(int)DoorLoc.top]; break; } if (adjacentWall.doorWall) { return(true); } else { return(false); } }
private void Start() { roomGen = GetComponentInParent <RoomGeneration> (); }
public void AdditionalRoom(RoomGeneration room) { roomQueue.Enqueue(room); allRooms.Add(room); }