public IEnumerator ElevatorMethod2() // SEQUENCE 28 { JanitorAttackOnElevator -= ElevatorMethod2; yield return(new WaitForSeconds(0.2f)); AudioSource aSourcePlayer = FindObjectOfType <PlayerController>().gameObject.GetComponent <AudioSource>(); float originalVolume = aSourcePlayer.volume; // ELEVATOR STARTS aSourcePlayer.PlayOneShot(Sons.instance.ElevadorInicio, aSourcePlayer.volume); yield return(new WaitForSeconds(Sons.instance.ElevadorInicio.length)); LightManager.instance.SetLightState(1, true); JanitorSpawner.instance.SpawnJanitorInFrontOfElevator(); // ELEVATOR STOPS secondFloorElevatorPanel2.elevator.limitL = -0.04f; secondFloorElevatorPanel2.elevator.limitR = 0.04f; secondFloorElevatorPanel2.elevator.activated = true; // JANITOR ATTACK aSourcePlayer.clip = (Sons.instance.MusicaDesespero1); aSourcePlayer.Play(); aSourcePlayer.PlayOneShot(Sons.instance.PaBatendoelevador, aSourcePlayer.volume); yield return(new WaitForSeconds(1)); aSourcePlayer.PlayOneShot(Sons.instance.PaDebatendoelevador, aSourcePlayer.volume); // ELEVATOR GOES AWAY yield return(new WaitForSeconds(4)); secondFloorElevatorPanel2.elevator.activated = false; aSourcePlayer.PlayOneShot(Sons.instance.ElevadorMovimentaçao, aSourcePlayer.volume); yield return(new WaitForSeconds(0.1f)); DestroyObject(FindObjectOfType <JanitorController>().gameObject); // ELEVATOR OPENS StartCoroutine(FindObjectOfType <PlayerController>().AudioSourceFade(false, 4, 0)); yield return(new WaitForSeconds(4)); aSourcePlayer.Stop(); aSourcePlayer.volume = originalVolume; FindObjectOfType <PlayerController>().gameObject.transform.position = secondFloorElevatorDestination.position; thirdFloorElevatorPanel.ChangeActiveState(true); thirdFloorElevatorPanel.OpenElevator(); thirdFloorElevatorPanel.ChangeActiveState(false); FindObjectOfType <PlayerController>().ChangeRootState(false); ElevatorTrigger2.GetComponent <BoxCollider>().enabled = true; }
public IEnumerator ElevatorMethod4() // SEQUENCE 31 { GroundElevatorGoesToRadioRoom -= ElevatorMethod4; AudioSource aSourcePlayer = FindObjectOfType <PlayerController>().gameObject.GetComponent <AudioSource>(); // STARTS THE ELEVATOR aSourcePlayer.PlayOneShot(Sons.instance.ElevadorInicio, aSourcePlayer.volume); yield return(new WaitForSeconds(Sons.instance.ElevadorInicio.length)); LightManager.instance.SetLightState(2, true); // MOVES THE ELEVATOR aSourcePlayer.clip = Sons.instance.ElevadorMovimentaçao; aSourcePlayer.Play(); yield return(new WaitForSeconds(5.5f)); salaDeRadioDoor.SetActive(false); // TELEPORTS THE PLAYER FindObjectOfType <PlayerController>().gameObject.transform.SetParent(groundFloorElevator.transform); yield return(new WaitForFixedUpdate()); groundFloorElevator.transform.position = new Vector3(104.145f, 16.561f, -2.94f); groundFloorElevator.transform.rotation = transform.rotation * Quaternion.AngleAxis(270, Vector3.up); yield return(new WaitForFixedUpdate()); FindObjectOfType <PlayerController>().gameObject.transform.parent = null; FindObjectOfType <PlayerController>().ChangeRootState(false); // STOPS THE ELEVATOR aSourcePlayer.Stop(); aSourcePlayer.PlayOneShot(Sons.instance.ElevadorPara, aSourcePlayer.volume); groundFloorElevatorPanel2.elevator.zAxis = true; groundFloorElevatorPanel2.OpenElevator(); yield return(new WaitForSeconds(Sons.instance.ElevadorPara.length)); }
public IEnumerator ElevatorMethod1() // SEQUENCE 20 { ElevatorAfterSecondRoom -= ElevatorMethod1; AudioSource aSourcePlayer = FindObjectOfType <PlayerController>().gameObject.GetComponent <AudioSource>(); // ROOTS THE PLAYER AND SHUTS THE DOOR FindObjectOfType <PlayerController>().ChangeRootState(true); thirdFloorElevatorPanel.CloseElevator(); thirdFloorElevatorPanel.ChangeActiveState(false); yield return(new WaitForSeconds(4)); // STARTS THE ELEVATOR aSourcePlayer.PlayOneShot(Sons.instance.ElevadorInicio, aSourcePlayer.volume); yield return(new WaitForSeconds(2.376f)); aSourcePlayer.clip = Sons.instance.ElevadorMovimentaçao; aSourcePlayer.Play(); // TELEPORTS THE PLAYER FindObjectOfType <PlayerController>().gameObject.transform.position = thirdFloorElevatorDestination.position; LightManager.instance.SetLightState(6, true); yield return(new WaitForSeconds(7)); // STOPS THE ELEVATOR aSourcePlayer.Stop(); aSourcePlayer.PlayOneShot(Sons.instance.ElevadorPara, aSourcePlayer.volume); yield return(new WaitForSeconds(2.064f)); secondFloorElevatorPanel.ChangeActiveState(true); secondFloorElevatorPanel.OpenElevator(); aSourcePlayer.clip = Sons.instance.MusicaPreenchimento1; aSourcePlayer.Play(); FindObjectOfType <PlayerController>().ChangeRootState(false); }
private void InteractObjects() { RaycastHit hit; if (!isInspecting) { if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out hit, interactionDistance)) { GameObject hitted = hit.collider.gameObject; if (hitted.GetComponent <IInventoryItem>() != null) { //InspectItem(hitted.gameObject.GetComponent<IInventoryItem>()); inventory.AddItem(hitted.gameObject.GetComponent <IInventoryItem>()); DestroyObject(hitted.gameObject); switch (hitted.tag) { case "Fita": if (hitted.GetComponent <PickupItem>().id == 3) { SequenceManager.instance.Sequence27Trigger(); } tapes.Add(hitted.gameObject.GetComponent <IInventoryItem>().id); break; case "Key": keys.Add(hitted.gameObject.GetComponent <IInventoryItem>().id); break; case "Lanterna": InspectItem(hitted.gameObject.GetComponent <IInventoryItem>()); lanternActive = true; zippoActive = false; break; case "Zippo": InspectItem(hitted.gameObject.GetComponent <IInventoryItem>()); lanternActive = false; zippoActive = true; break; } } else { switch (hitted.tag) { case "Gravador": Transform tapePanel = hud.transform.Find("TapePanel"); tapePanel.gameObject.SetActive(true); Cursor.lockState = CursorLockMode.None; Cursor.visible = true; isReproducingTape = true; for (int i = 0; i < tapes.Count; i++) { Transform tape = tapePanel.GetChild(tapes[i]); Button button = tape.GetComponent <Button>(); button.interactable = true; } break; case "Gerador": hitted.gameObject.GetComponent <Generator>().InteractGenerator(); break; case "Panel": if (keys.Contains(-8)) { DoorManager.instance.LockUnlockDoor(-8, true); } break; case "TV": hitted.gameObject.GetComponent <Television>().ChangeState(); break; case "Flammable": if (zippoActive) { if (hitted.gameObject.GetComponent <FlammableObjects>() != null) { hitted.gameObject.GetComponent <FlammableObjects>().BurnMaterial(); } } break; // ELEVADOR case "Elevator Panel": if (hitted.gameObject.GetComponent <ElevatorPanel>() != null) { ElevatorPanel elevator = hitted.gameObject.GetComponent <ElevatorPanel>(); if (elevator.activated) { aSource.PlayOneShot(Sons.instance.ElevadorBotao, aSource.volume); } else { aSource.PlayOneShot(Sons.instance.IdentificadordesenhaSenhaincorreta, aSource.volume); } if (elevator.id == 2) // THIS ELEVATOR WAS BUGGED { if (tapes.Contains(3)) { elevator.activated = true; elevator.OpenElevator(); } } if (elevator.id == 1 || elevator.id == 4) { elevator.OpenElevator(); } if (elevator.id == 3) { if (elevator.TimesClicked < 3) { elevator.TimesClicked += 1; } if (elevator.TimesClicked >= 3) { SequenceManager.instance.Sequence28Trigger(); } } if (elevator.id == 5) { SequenceManager.instance.Sequence31Trigger(); } } break; case "Door": if (hitted.gameObject.GetComponent <Door2>() != null) { bool unlock = false; // EVENTO SALA VIVA --- if (hitted.gameObject.GetComponent <Door2>().id == 4) { SequenceManager.instance.Sequence6Trigger(); } // EVENTO SALA VIVA --- if (hitted.gameObject.GetComponent <Door2>().hasAlarm) { if (hitted.gameObject.GetComponent <Door2>().id == 5) { hitted.gameObject.GetComponent <Door2>().StartCoroutine(hitted.gameObject.GetComponent <Door2>().PlayAlarm()); EventManager.instance.Event2Trigger(); } } else { if (hitted.gameObject.GetComponent <Door2>().isLocked) { if (hitted.gameObject.GetComponent <Door2>().type == Types.Key) { for (int i = 0; i < keys.Count; i++) { if (keys[i] == hitted.gameObject.GetComponent <Door2>().id) { unlock = true; hitted.gameObject.GetComponent <Door2>().UnlockDoor(); keys.RemoveAt(i); } } if (!unlock) { hitted.gameObject.GetComponent <Door2>().SoundLocked(); } else { openingDoor = true; door = hitted.gameObject; if (keys.Count == 0) { inventory.RemoveItem("Key"); } } } else if (hitted.gameObject.GetComponent <Door2>().type == Types.Glass) { hitted.gameObject.GetComponent <Door2>().UnlockDoor(); // EVENT if (hitted.gameObject.GetComponent <Door2>().id == 12) { SequenceManager.instance.Sequence22Trigger(); } // EVENT } } else { openingDoor = true; door = hitted.gameObject; } } } else { openingDoor = true; door = hitted.gameObject; } break; case "Gaveta": openingDoor = true; door = hitted.gameObject; break; case "Cover": timer = Time.time; AudioSource audioSource = GetComponent <AudioSource>(); audioSource.PlayOneShot(Sons.instance.DutoTampaArrancada, audioSource.volume); openingDoor = true; door = hitted.gameObject; break; } } //Debug.Log(hitted.tag); } } else { inventory.AddItem(inspectedInterface); DestroyObject(inspectedItem); inspectedItem = null; isInspecting = false; } }