// Update is called once per frame void Update() { if (StartMenu.activeInHierarchy) { Time.timeScale = 0f; Cursor.lockState = CursorLockMode.None; Cursor.visible = true; WeaponPickup wp = FindObjectOfType <WeaponPickup> (); if (wp != null) { wp.SetAlive(false); } SwitchWeapon sw = GameObject.Find("Camera").GetComponent <SwitchWeapon> (); if (sw != null) { sw.SetAlive(false); } MouseLook ml = FindObjectOfType <MouseLook> (); if (ml != null) { ml.SetAlive(false); } player.GetComponent <MouseLook> ().enabled = false; } }
void OnTriggerEnter(Collider other) { PlayerCharacter player = other.GetComponent <PlayerCharacter>(); if (safe) { missiontext.SetActive(true); resett.SetActive(true); exitt.SetActive(true); FPSInput f = FindObjectOfType <FPSInput> (); if (f != null) { f.SetAlive(false); } WeaponPickup wp = FindObjectOfType <WeaponPickup> (); if (wp != null) { wp.SetAlive(false); } SwitchWeapon sw = GameObject.Find("Camera").GetComponent <SwitchWeapon> (); if (sw != null) { sw.SetAlive(false); } GameObject[] e = GameObject.FindGameObjectsWithTag("Enemy"); Shooting[] s = new Shooting[e.Length]; for (int i = 0; i < e.Length; i++) { s[i] = e [i].GetComponent <Shooting> (); if (s [i] != null) { s[i].SetAlive(false); } } CrateShooting[] cs = new CrateShooting[e.Length]; for (int i = 0; i < e.Length; i++) { cs[i] = e [i].GetComponent <CrateShooting> (); if (cs [i] != null) { cs[i].SetAlive(false); } } StartCoroutine(startCutScene()); } }
private IEnumerator startCutScene() { player.SetActive(false); canvas.SetActive(false); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; cameraCutScene.SetActive(true); heli.SetActive(true); yield return(new WaitForSeconds(5.0f)); player.SetActive(true); canvas.SetActive(true); cameraCutScene.SetActive(false); heli.SetActive(false); WeaponPickup wp = FindObjectOfType <WeaponPickup> (); if (wp != null) { wp.SetAlive(true); } SwitchWeapon sw = GameObject.Find("Camera").GetComponent <SwitchWeapon> (); if (sw != null) { sw.SetAlive(true); } MouseLook ml = FindObjectOfType <MouseLook> (); if (ml != null) { ml.SetAlive(true); } player.GetComponent <MouseLook> ().enabled = true; }
void Update() { if (_health == 0) { FPSInput f = GetComponent <FPSInput> (); f.SetAlive(false); WeaponPickup wp = FindObjectOfType <WeaponPickup> (); if (wp != null) { wp.SetAlive(false); } SwitchWeapon sw = GameObject.Find("Camera").GetComponent <SwitchWeapon> (); if (sw != null) { sw.SetAlive(false); } GameObject[] e = GameObject.FindGameObjectsWithTag("Enemy"); Shooting[] s = new Shooting[e.Length]; for (int i = 0; i < e.Length; i++) { s[i] = e [i].GetComponent <Shooting> (); if (s [i] != null) { s[i].SetAlive(false); } } CrateShooting[] cs = new CrateShooting[e.Length]; for (int i = 0; i < e.Length; i++) { cs[i] = e [i].GetComponent <CrateShooting> (); if (cs [i] != null) { cs[i].SetAlive(false); } } Gameovert.SetActive(true); resett.SetActive(true); exitt.SetActive(true); } if (_health == 0) { healthbar1.SetActive(false); healthbar2.SetActive(false); healthbar3.SetActive(false); healthbar4.SetActive(false); healthbar5.SetActive(false); healthbar6.SetActive(false); healthbar7.SetActive(false); healthbar8.SetActive(false); healthbar9.SetActive(false); healthbar10.SetActive(false); healthbar11.SetActive(false); } if (_health == 1) { healthbar1.SetActive(true); healthbar2.SetActive(false); healthbar3.SetActive(false); healthbar4.SetActive(false); healthbar5.SetActive(false); healthbar6.SetActive(false); healthbar7.SetActive(false); healthbar8.SetActive(false); healthbar9.SetActive(false); healthbar10.SetActive(false); healthbar11.SetActive(false); } if (_health == 2) { healthbar1.SetActive(true); healthbar2.SetActive(true); healthbar3.SetActive(false); healthbar4.SetActive(false); healthbar5.SetActive(false); healthbar6.SetActive(false); healthbar7.SetActive(false); healthbar8.SetActive(false); healthbar9.SetActive(false); healthbar10.SetActive(false); healthbar11.SetActive(false); } if (_health == 3) { healthbar1.SetActive(true); healthbar2.SetActive(true); healthbar3.SetActive(true); healthbar4.SetActive(false); healthbar5.SetActive(false); healthbar6.SetActive(false); healthbar7.SetActive(false); healthbar8.SetActive(false); healthbar9.SetActive(false); healthbar10.SetActive(false); healthbar11.SetActive(false); } if (_health == 4) { healthbar1.SetActive(true); healthbar2.SetActive(true); healthbar3.SetActive(true); healthbar4.SetActive(true); healthbar5.SetActive(false); healthbar6.SetActive(false); healthbar7.SetActive(false); healthbar8.SetActive(false); healthbar9.SetActive(false); healthbar10.SetActive(false); healthbar11.SetActive(false); } if (_health == 5) { healthbar1.SetActive(true); healthbar2.SetActive(true); healthbar3.SetActive(true); healthbar4.SetActive(true); healthbar5.SetActive(true); healthbar6.SetActive(false); healthbar7.SetActive(false); healthbar8.SetActive(false); healthbar9.SetActive(false); healthbar10.SetActive(false); healthbar11.SetActive(false); } if (_health == 6) { healthbar1.SetActive(true); healthbar2.SetActive(true); healthbar3.SetActive(true); healthbar4.SetActive(true); healthbar5.SetActive(true); healthbar6.SetActive(true); healthbar7.SetActive(false); healthbar8.SetActive(false); healthbar9.SetActive(false); healthbar10.SetActive(false); healthbar11.SetActive(false); } if (_health == 7) { healthbar1.SetActive(true); healthbar2.SetActive(true); healthbar3.SetActive(true); healthbar4.SetActive(true); healthbar5.SetActive(true); healthbar6.SetActive(true); healthbar7.SetActive(true); healthbar8.SetActive(false); healthbar9.SetActive(false); healthbar10.SetActive(false); healthbar11.SetActive(false); } if (_health == 8) { healthbar1.SetActive(true); healthbar2.SetActive(true); healthbar3.SetActive(true); healthbar4.SetActive(true); healthbar5.SetActive(true); healthbar6.SetActive(true); healthbar7.SetActive(true); healthbar8.SetActive(true); healthbar9.SetActive(false); healthbar10.SetActive(false); healthbar11.SetActive(false); } if (_health == 9) { healthbar1.SetActive(true); healthbar2.SetActive(true); healthbar3.SetActive(true); healthbar4.SetActive(true); healthbar5.SetActive(true); healthbar6.SetActive(true); healthbar7.SetActive(true); healthbar8.SetActive(true); healthbar9.SetActive(true); healthbar10.SetActive(false); healthbar11.SetActive(false); } if (_health == 10) { healthbar1.SetActive(true); healthbar2.SetActive(true); healthbar3.SetActive(true); healthbar4.SetActive(true); healthbar5.SetActive(true); healthbar6.SetActive(true); healthbar7.SetActive(true); healthbar8.SetActive(true); healthbar9.SetActive(true); healthbar10.SetActive(true); healthbar11.SetActive(false); } if (_health == 11) { healthbar1.SetActive(true); healthbar2.SetActive(true); healthbar3.SetActive(true); healthbar4.SetActive(true); healthbar5.SetActive(true); healthbar6.SetActive(true); healthbar7.SetActive(true); healthbar8.SetActive(true); healthbar9.SetActive(true); healthbar10.SetActive(true); healthbar11.SetActive(true); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.P)) { if (Time.timeScale == 1.0f) { pauseText.SetActive(true); exitText.SetActive(true); audioText.SetActive(true); WeaponPickup wp = FindObjectOfType <WeaponPickup> (); if (wp != null) { wp.SetAlive(false); } SwitchWeapon sw = GameObject.Find("Camera").GetComponent <SwitchWeapon> (); if (sw != null) { sw.SetAlive(false); } MouseLook ml = FindObjectOfType <MouseLook> (); if (ml != null) { ml.SetAlive(false); } player.GetComponent <MouseLook> ().enabled = false; Cursor.lockState = CursorLockMode.None; Cursor.visible = true; Time.timeScale = 0.0f; } else if (Time.timeScale == 0.0f) { pauseText.SetActive(false); exitText.SetActive(false); audioText.SetActive(false); WeaponPickup wp = FindObjectOfType <WeaponPickup> (); if (wp != null) { wp.SetAlive(true); } SwitchWeapon sw = GameObject.Find("Camera").GetComponent <SwitchWeapon> (); if (sw != null) { sw.SetAlive(true); } MouseLook ml = FindObjectOfType <MouseLook> (); if (ml != null) { ml.SetAlive(true); } player.GetComponent <MouseLook> ().enabled = true; Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; Time.timeScale = 1.0f; } } }