Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public GameObject shootCannon;
- public PlayableDirector timeline;
- public GameObject singleChar;
- public Camera laserCam;
- private void Start()
- {
- shootCannon.SetActive(false);
- timeline.Stop();
- laserCam.enabled = false;
- }
- private void OnTriggerEnter(Collider other)
- {
- shootCannon.SetActive(true);
- }
- private void OnTriggerExit(Collider other)
- {
- shootCannon.SetActive(false);
- }
- private void Update()
- {
- if (shootCannon.activeInHierarchy == true && Input.GetKeyDown(KeyCode.E))
- {
- timeline.Play();
- GetComponent<BoxCollider>().enabled = false;
- shootCannon.SetActive(false);
- StartCoroutine(LaserShooting());
- singleChar.SetActive(false);
- }
- }
- IEnumerator LaserShooting()
- {
- laserCam.enabled = true;
- GameObject.FindGameObjectWithTag("Player").GetComponent<CharacterController>().enabled = false;
- GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent<CharacterController>().enabled = false;
- yield return new WaitForSeconds(0.60f);
- FindObjectOfType<SoundController>().cannonFire.Play();
- yield return new WaitForSeconds(0.45f);
- FindObjectOfType<SoundController>().woodBreaking.Play();
- yield return new WaitForSeconds(2f);
- FindObjectOfType<SoundController>().cannonFire.Play();
- yield return new WaitForSeconds(0.45f);
- FindObjectOfType<SoundController>().woodBreaking.Play();
- yield return new WaitForSeconds(1);
- GameObject.FindGameObjectWithTag("Player").GetComponent<CharacterController>().enabled = true;
- GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent<CharacterController>().enabled = true;
- laserCam.enabled = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment