public void OnPlayerEnterRoom(RoomParent roomParent) { // Debug.Log("OnPlayerEnterRoom is being called"); MyCamera.Instance.CurrentRoom = roomParent; MyCamera.Instance.m_IsUpdatingPosition = true; //this is the only code that sets this to true // Debug.Log("Camera is updating position: " + MyCamera.Instance.m_IsUpdatingPosition); }
public void FindEndRoomFurthestAway() { RoomParent[] currentRooms = FindObjectsOfType <RoomParent>(); foreach (RoomParent room in currentRooms) { if (room.IsEndRoom()) { deadEnds.Add(room); } } int furthestAway = 0; foreach (RoomParent deadEnd in deadEnds) { if (deadEnd.stepsAwayFromMain > furthestAway) { furthestAway = deadEnd.stepsAwayFromMain; } } deadEndsFurthestAway.AddRange(deadEnds.FindAll(deadEnd => deadEnd.stepsAwayFromMain == furthestAway)); if (deadEndsFurthestAway.Count > 1) { ChooseBossRoom(); } else { bossRoom = deadEndsFurthestAway[0]; } }
public void OnPlayerEnterRoom(RoomParent roomParent) { GameCamera.Instance.CurrentRoom = roomParent; LoadRoom(GetRandomRegularRoomName(), roomParent.X + 1, roomParent.Y); LoadRoom(GetRandomRegularRoomName(), roomParent.X - 1, roomParent.Y); LoadRoom(GetRandomRegularRoomName(), roomParent.X, roomParent.Y + 1); LoadRoom(GetRandomRegularRoomName(), roomParent.X, roomParent.Y - 1); }
public void OnPlayerEnterRoom(RoomParent roomParent) { CameraMovement.Instance.currentRoom = roomParent; LoadRoom(RandomRoomName(), roomParent.X + 1, roomParent.Y); LoadRoom(RandomRoomName(), roomParent.X - 1, roomParent.Y); LoadRoom(RandomRoomName(), roomParent.X, roomParent.Y + 1); LoadRoom(RandomRoomName(), roomParent.X, roomParent.Y - 1); }
public void OnPlayerEnterRoom(RoomParent roomParent) { GameCamera.Instance.CurrentRoom = roomParent; //Our room buffer and allthat so no empty sides LoadRoom(GetRandomRegularRoomName(), roomParent.X + 1, roomParent.Y); LoadRoom(GetRandomRegularRoomName(), roomParent.X - 1, roomParent.Y); LoadRoom(GetRandomRegularRoomName(), roomParent.X, roomParent.Y + 1); LoadRoom(GetRandomRegularRoomName(), roomParent.X, roomParent.Y - 1); }
public void RegisterRoom(RoomParent roomParent) { roomParent.transform.position = new Vector3(m_CurrentLoadRoomData.X * roomParent.Width, m_CurrentLoadRoomData.Y * roomParent.Height, 0); roomParent.X = m_CurrentLoadRoomData.X; roomParent.Y = m_CurrentLoadRoomData.Y; roomParent.name = m_CurrentWorldName + "-" + m_CurrentLoadRoomData.Name + "-" + roomParent.X + "-" + roomParent.Y; m_IsLoadingRoom = false; if (m_LoadedRooms.Count == 0) { GameCamera.Instance.CurrentRoom = roomParent; } m_LoadedRooms.Add(roomParent); }
public float DestroyProbability; //Will this door actually be there on instantiation private void Start() { RoomParent roomParent = GetComponentInParent <RoomParent>(); float randomValue = Random.Range(0f, 1f); if (randomValue < DestroyProbability || (roomParent.X == 0 && roomParent.Y == 0) || (roomParent.X == 0 && roomParent.Y == 1) || (roomParent.X == 0 && roomParent.Y == -1) || (roomParent.X == 1 && roomParent.Y == -1) || (roomParent.X == 1 && roomParent.Y == -2)) { Destroy(gameObject); } }
public void RegisterRoom(RoomParent roomParent) { roomParent.transform.position = new Vector3(currentLoadRoomData.X * roomParent.Width, currentLoadRoomData.Y * roomParent.Height, 0); roomParent.X = currentLoadRoomData.X; roomParent.Y = currentLoadRoomData.Y; // roomParent.name = currentWorldName + " - " + currentLoadRoomData.Name + " " + roomParent.X + ", " + roomParent.Y; roomParent.name = currentLoadRoomData.Name + " " + roomParent.X + ", " + roomParent.Y; isLoadingRoom = false; if (loadedRooms.Count == 0) { CameraMovement.Instance.currentRoom = roomParent; } loadedRooms.Add(roomParent); }
private void OnTriggerEnter2D(Collider2D collider) { // Debug.Log("Triggered the RoomTransition"); if (RoomManager.Instance != null) { // Debug.Log("Room Manager is here"); if (MyCamera.Instance.CurrentRoom != MyRoomParent) //This should make sure that you dont transition into the transitioner while in the same room as it { // Debug.Log(collider.name + "You are not in my room"); if (collider.tag == "Player") { // Debug.Log("Tag is Player"); RoomManager.MyInstance.OnPlayerEnterRoomTransition(this); RoomParent roomParent = GetComponentInParent <RoomParent>(); RoomManager.MyInstance.OnPlayerEnterRoom(roomParent); } } } }
public void OnPlayerEnterRoom(RoomParent roomParent) { //so the +1 and -1 here decides how far away from the current room the next room should spawn //Im pretty sure that if I turn those into variables, I will be able to inherit them from the RoomParent //And make bigger rooms GameCamera.Instance.CurrentRoom = roomParent; if (DoesRoomExist(roomParent.X + 1, roomParent.Y) == false) { LoadRoom(GetRandomRegularRoomName(), roomParent.X + 1, roomParent.Y); } if (DoesRoomExist(roomParent.X - 1, roomParent.Y) == false) { LoadRoom(GetRandomRegularRoomName(), roomParent.X - 1, roomParent.Y); } if (DoesRoomExist(roomParent.X, roomParent.Y + 1) == false) { LoadRoom(GetRandomRegularRoomName(), roomParent.X, roomParent.Y + 1); } if (DoesRoomExist(roomParent.X, roomParent.Y - 1) == false) { LoadRoom(GetRandomRegularRoomName(), roomParent.X, roomParent.Y - 1); } }
public void RegisterRoom( RoomParent roomParent ) { roomParent.transform.position = new Vector3( m_CurrentLoadRoomData.X * roomParent.Width, m_CurrentLoadRoomData.Y * roomParent.Height, 0 ); roomParent.X = m_CurrentLoadRoomData.X; roomParent.Y = m_CurrentLoadRoomData.Y; roomParent.name = m_CurrentWorldName + "-" + m_CurrentLoadRoomData.Name + " " + roomParent.X + ", " + roomParent.Y; roomParent.transform.parent = transform; m_IsLoadingRoom = false; if( m_LoadedRooms.Count == 0 ) { GameCamera.Instance.CurrentRoom = roomParent; } m_LoadedRooms.Add( roomParent ); }
public void OnPlayerEnterRoom( RoomParent roomParent ) { GameCamera.Instance.CurrentRoom = roomParent; LoadRoom( GetRandomRegularRoomName(), roomParent.X + 1, roomParent.Y ); LoadRoom( GetRandomRegularRoomName(), roomParent.X - 1, roomParent.Y ); LoadRoom( GetRandomRegularRoomName(), roomParent.X, roomParent.Y + 1 ); LoadRoom( GetRandomRegularRoomName(), roomParent.X, roomParent.Y - 1 ); }
public void ChooseBossRoom() { System.Random r = new System.Random(); bossRoom = deadEndsFurthestAway[r.Next(0, deadEndsFurthestAway.Count - 1)]; }