ActivateEffects.cs 409 B

12345678910111213141516171819202122
  1. using UnityEngine;
  2. using System.Collections;
  3. public class ActivateEffects : MonoBehaviour {
  4. public ParticleSystem particleEffect;
  5. void OnTriggerEnter (Collider other)
  6. {
  7. if(other.gameObject.tag == "Player")
  8. {
  9. particleEffect.Play ();
  10. GetComponent<AudioSource>().Play ();
  11. }
  12. }
  13. void OnTriggerExit (Collider other)
  14. {
  15. particleEffect.Stop();
  16. GetComponent<AudioSource>().Stop();
  17. }
  18. }