//Player/Enemies Collision private void OnTriggerEnter(Collider other) { if (other.tag == "Enemy 1") { if (CheeseEquipped.activeInHierarchy == false && CheeseEquippedEnemies1.activeInHierarchy == true) { //CheeseWaitTImer(); CheeseEquipped.SetActive(true); CheeseEquippedEnemies1.SetActive(false); } } if (other.tag == "Enemy 2") { if (CheeseEquipped.activeInHierarchy == false && CheeseEquippedEnemies2.activeInHierarchy == true) { //CheeseWaitTImer(); CheeseEquipped.SetActive(true); CheeseEquippedEnemies2.SetActive(false); } } if (other.tag == "Enemy 3") { if (CheeseEquipped.activeInHierarchy == false && CheeseEquippedEnemies3.activeInHierarchy == true) { //CheeseWaitTImer(); CheeseEquipped.SetActive(true); CheeseEquippedEnemies3.SetActive(false); } } if (other.tag == "Cheese") { CheeseManager.Instance.EquippedPlayer(); } //Parenting Cheese /* * if (other.tag == "Cheese") * { * Cheese.transform.parent = this.transform; * Cheese.transform.position = this.transform.position; * } */ }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.GetComponent <EnemiesController1>()) { if (CheeseEquipped.activeInHierarchy == false && CheeseEquippedEnemies1.activeInHierarchy == true && WasHit == false) { AudioController.Instance.PlayBumpAudio(); CheeseEquipped.SetActive(true); CheeseEquippedEnemies1.SetActive(false); TimeBetweenHit = 3; WasHit = true; } else if (CheeseEquipped.activeInHierarchy == true && CheeseEquippedEnemies1.activeInHierarchy == false && WasHit == false && ShieldEquipped.activeInHierarchy == false) { AudioController.Instance.PlayBumpAudio(); CheeseEquipped.SetActive(false); CheeseEquippedEnemies1.SetActive(true); TimeBetweenHit = 3; WasHit = true; } } if (collision.gameObject.GetComponent <EnemiesController2>()) { if (CheeseEquipped.activeInHierarchy == false && CheeseEquippedEnemies2.activeInHierarchy == true && WasHit == false) { AudioController.Instance.PlayBumpAudio(); CheeseEquipped.SetActive(true); CheeseEquippedEnemies2.SetActive(false); TimeBetweenHit = 3; WasHit = true; } else if (CheeseEquipped.activeInHierarchy == true && CheeseEquippedEnemies2.activeInHierarchy == false && WasHit == false && ShieldEquipped.activeInHierarchy == false) { AudioController.Instance.PlayBumpAudio(); CheeseEquipped.SetActive(false); CheeseEquippedEnemies2.SetActive(true); TimeBetweenHit = 3; WasHit = true; } } if (collision.gameObject.GetComponent <EnemiesController3>()) { if (CheeseEquipped.activeInHierarchy == false && CheeseEquippedEnemies3.activeInHierarchy == true && WasHit == false) { AudioController.Instance.PlayBumpAudio(); CheeseEquipped.SetActive(true); CheeseEquippedEnemies3.SetActive(false); TimeBetweenHit = 3; WasHit = true; } else if (CheeseEquipped.activeInHierarchy == true && CheeseEquippedEnemies3.activeInHierarchy == false && WasHit == false && ShieldEquipped.activeInHierarchy == false) { AudioController.Instance.PlayBumpAudio(); CheeseEquipped.SetActive(false); CheeseEquippedEnemies3.SetActive(true); TimeBetweenHit = 3; WasHit = true; } } if (collision.gameObject.GetComponent <CheeseDetectScript>()) { AudioController.Instance.PlayCheeseAudio(); CheeseManager.Instance.EquippedPlayer(); } }
public void EquippedEnemies3() { Cheese.SetActive(false); CheeseEquippedEnemies3.SetActive(true); }