Advertisement
kadyr

Untitled

Aug 29th, 2021
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Grenade : MonoBehaviour
  6. {
  7. protected float coolDown;
  8. private float timer;
  9. public virtual void Bam()
  10. {
  11. //Здесь происходит взрыв гранаты
  12. }
  13.  
  14. private void Update()
  15. {
  16. if (timer > coolDown)
  17. {
  18. //timer = 0; useless code don't do this, PLEASEEE!!!
  19. Bam();
  20. Destroy(this.gameObject);
  21. }
  22.  
  23. timer += Time.deltaTime;
  24. }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement