Advertisement
kadyr

Untitled

Jul 10th, 2021
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GranadeScript : MonoBehaviour
  6. {
  7.     float time = 0;
  8.     float coolDown = 3f;
  9.     bool played = false;
  10.     private void Update() {
  11.         time += Time.deltaTime;
  12.         if(time > coolDown && !played){
  13.             played = true;
  14.             GetComponentInChildren<ParticleSystem>().Play();
  15.             Destroy(this.gameObject);
  16.         }    
  17.     }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement