private void ChangeRoom(Room newRoom) { if (newRoom != currentRoom) { //switchedRooms = true; //StartCoroutine(JustSwitchedRooms()); if (currentRoom != null && currentRoom.GetRoomType() == RoomType.Secure) { SecureRoom room = (SecureRoom)currentRoom; room.UpdatePlayerInRoom(false); } if (newRoom.GetRoomType() == RoomType.Secure) { SecureRoom room = (SecureRoom)newRoom; room.UpdatePlayerInRoom(true); player.SetKnockout(!room.hasAlerted); } currentRoom = newRoom; roomManager.ChangeRoom(currentRoom); cameraFollow.ChangeRoom(currentRoom); minimapCamera.MoveLocation(currentRoom); currentRoom.VisitRoom(); audienceManager.SetCurrentRoomLocation(currentRoom.X, currentRoom.Z); } }
public void Tripped() { ActionLineCrossed(); SecureRoom room = (SecureRoom)parentRoom; SoundRequest.RequestSound("Zap"); //if (!room.hasAlerted) //{ // room.NotifyEnemiesOfPlayer(); //} }
public void SetAlert() { anim.SetBool("Alerted", true); SecureRoom newRoom = (SecureRoom)parentRoom; if (!newRoom.hasAlerted) { newRoom.RoomAlerted(); newRoom.NotifyEnemiesOfPlayer(); newRoom.AlertCameras(); } }
public void SawPlayer() { ActionSawPlayer(); SecureRoom newRoom = (SecureRoom)parentRoom; if (!newRoom.hasAlerted) { newRoom.RoomAlerted(); newRoom.NotifyEnemiesOfPlayer(); } newRoom.AlertCameras(); }
public void InitializeEnemy(int num, List <Transform> possibleNodes, SecureRoom parent) { mainCam = Camera.main; health = GetComponent <Health>(); health.Init(); healthBarReferenceID = -1; stealthReferenceID = -1; stunReferenceID = -1; parentRoom = parent; allNodes = possibleNodes; lightAnim = GetComponent <Animator>(); modelAnim = transform.GetChild(1).GetComponent <Animator>(); fov = GetComponent <FieldOfView>(); agent = GetComponent <NavMeshAgent>(); player = FindObjectOfType <PlayerController>().gameObject; numberOfNodesInPath = num; path = new Transform[numberOfNodesInPath]; GeneratePath(possibleNodes); currState = new PatrolState(); currState.OnEnter(this); AlertChanged(0); noticedPlayer = false; playerInRoom = false; attacked = false; inLockDown = false; stun = false; Physics.IgnoreLayerCollision(11, 14); Physics.IgnoreLayerCollision(11, 16); lastPosition = transform.position; particle.SetActive(false); showStealthPopUp = false; }
private void CameraAction() { if (state == InteractableState.negative) { sight.SetActive(false); state = InteractableState.positive; sight.GetComponent <CameraSight>().detectPlayer = false; particle.SetActive(true); SecureRoom room = (SecureRoom)parentRoom; room.TurnCamerasOnOff(false); } else { sight.SetActive(true); state = InteractableState.negative; sight.GetComponent <CameraSight>().detectPlayer = true; particle.SetActive(false); SecureRoom room = (SecureRoom)parentRoom; room.TurnCamerasOnOff(true); } }
private void TripwireAction() { if (state == InteractableState.negative) { for (int j = 0; j < tripwireLasers.Length; ++j) { tripwireLasers[j].gameObject.SetActive(false); } p1.SetActive(true); p2.SetActive(true); state = InteractableState.positive; mover.move = false; SecureRoom room = (SecureRoom)parentRoom; room.TurnTripwiresOnOff(false); } else { for (int j = 0; j < tripwireLasers.Length; ++j) { tripwireLasers[j].gameObject.SetActive(true); } p1.SetActive(false); p2.SetActive(false); state = InteractableState.negative; if (isMovingTripwire) { mover.move = true; } SecureRoom room = (SecureRoom)parentRoom; room.TurnTripwiresOnOff(true); } }
private void SpawnRooms(GridSpace[,] gridSpaces, int col, int row) { spawnedSecureRooms = new List <SecureRoom>(); for (int i = 0; i < col; ++i) { for (int j = 0; j < row; j++) { GameObject room = null; Vector3 pos = new Vector3(28 * i - (2 * 28), 0, 28 * j - (2 * 28)); int randomIndex; GridSpace thisSpot = gridSpaces[i, j]; if (thisSpot == GridSpace.objective) { room = Instantiate(objectiveRoom, pos, Quaternion.identity); } else if (thisSpot == GridSpace.secure) { //Grabs Random Room from the List based on index randomIndex = Random.Range(0, possibleSecureRooms.Count); room = Instantiate(possibleSecureRooms[randomIndex], pos, Quaternion.identity); } else if (thisSpot == GridSpace.civilian) { //Grabs Random Room from the List based on index randomIndex = Random.Range(0, possibleCivilianRooms.Count); room = Instantiate(possibleCivilianRooms[randomIndex], pos, Quaternion.identity); } else if (thisSpot == GridSpace.gala) { //Grabs Random Room from the List based on index randomIndex = Random.Range(1, possibleGalaRooms.Count); if (startingRoom == null) { room = Instantiate(possibleGalaRooms[0], pos, Quaternion.identity); startingRoom = room.GetComponent <Room>(); currentRoom = startingRoom; } else { room = Instantiate(possibleGalaRooms[randomIndex], pos, Quaternion.identity); } } else if (thisSpot == GridSpace.edge) { room = Instantiate(edgeRoom, pos, Quaternion.identity); room.GetComponent <EdgeRoom>().Create(CreateEdge(gridSpaces, i, j), wallTypes); room.transform.SetParent(transform); continue; } if (room != null) { room.transform.SetParent(transform); roomLayout[i, j] = room.GetComponent <Room>(); if (thisSpot == GridSpace.secure || thisSpot == GridSpace.objective) { SecureRoom scr = room.GetComponent <SecureRoom>(); spawnedSecureRooms.Add(scr); scr.GiveQuad(alertQuad); } string alphanumeric = alphabet.Substring(i, 1) + (roomLayout.GetLength(1) - j).ToString(); bool[] doors = CheckWalls(gridSpaces, i, j); roomLayout[i, j].Setup(i, j, alphanumeric, Room.GetRoomTypeFromGridSpace(thisSpot), doors, wallTypes); roomLayout[i, j].GiveMaterial(hiddenMat); if (thisSpot != GridSpace.edge) { navMeshBaker.AddSurface(room.GetComponent <NavMeshSurface>()); } } } } }
private void SpawnEnemy() { SecureRoom room = (SecureRoom)parentRoom; room.SpawnGuard(); }
private void IncapacitateGuards() { SecureRoom room = (SecureRoom)parentRoom; room.EMPGuards(); }