You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
290 B
C#
23 lines
290 B
C#
4 weeks ago
|
using UnityEngine;
|
||
|
|
||
|
namespace Projectiles
|
||
|
{
|
||
|
public class DestroyAfter : MonoBehaviour
|
||
|
{
|
||
|
[SerializeField]
|
||
|
private float _delay = 3f;
|
||
|
|
||
|
private float _time;
|
||
|
|
||
|
protected void Update()
|
||
|
{
|
||
|
_time += Time.deltaTime;
|
||
|
|
||
|
if (_time >= _delay)
|
||
|
{
|
||
|
Destroy(gameObject);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|