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
- {
- //релазиация таймера
- private float time = 0;
- [SerializeField]
- private float coolDown = 3f;
- private bool isPlayed;
- void Update()
- {
- time += Time.deltaTime;
- if (time > coolDown && !isPlayed)
- {
- //взрыв
- GetComponentInChildren<ParticleSystem>().Play();
- isPlayed = true;
- //уничтожение гранаты
- Destroy(this, 0.5f);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement