Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Grenade : MonoBehaviour
- {
- protected float coolDown;
- private float timer;
- public virtual void Bam()
- {
- //Здесь происходит взрыв гранаты
- }
- private void Update()
- {
- if (timer > coolDown)
- {
- //timer = 0; useless code don't do this, PLEASEEE!!!
- Bam();
- Destroy(this.gameObject);
- }
- timer += Time.deltaTime;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement