public void Activate(Hunted victime, AudioSource source) { if (!victime.invulnerable) { source.PlayOneShot(sound, 1); victime.invulnerable = true; sonar.startEffect(); switch (trapType) { case TrapType.BearTrap: victime.isTrapped = true; victime.isBleeding = true; Destroy(gameObject); break; case TrapType.Gravel: break; case TrapType.Glass: Destroy(gameObject); break; case TrapType.Hole: victime.isTrapped = true; break; default: break; } } }
//on collision play sound+change bool in player+destroykey public void keyCollide(Hunted victime, AudioSource source) { source.PlayOneShot(sound, 0.5f); victime.gotKey = true; gameObject.GetComponent <Renderer>().enabled = false; Destroy(this.gameObject); }
public void PickUpBonus(Hunted hunted, AudioSource source) { if (Input.GetKey("w") && !hunted.bonus) { hunted.bonus = this; gameObject.GetComponent <Renderer>().enabled = false; } }
public void doorCollide(Hunted victime, AudioSource source) { if (isOpen) { SceneManager.LoadScene("scene_victoire"); } else { if (victime.gotKey) { if (!isOpening) { source.PlayOneShot(sound, 1.2f); } isOpening = true; animator.SetInteger("Ouverture", 1); } } }