BuffEffect.cs 501 B

1234567891011121314151617181920212223242526
  1. using UnityEngine;
  2. using System.Collections;
  3. public class BuffEffect : MonoBehaviour {
  4. public float delayRemove = 1f;
  5. private float removeTime = -1f;
  6. public void Remove()
  7. {
  8. ParticleSystem[] psArr = GetComponentsInChildren<ParticleSystem>();
  9. for(int i=0; i<psArr.Length; i++)
  10. {
  11. psArr[i].enableEmission = false;
  12. }
  13. }
  14. // Update is called once per frame
  15. void Update ()
  16. {
  17. if(removeTime >= 0 && GameTime.time - removeTime > delayRemove)
  18. {
  19. Destroy(this.gameObject);
  20. }
  21. }
  22. }