update
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.FPS.Game
|
||||
{
|
||||
public class TimedSelfDestruct : MonoBehaviour
|
||||
{
|
||||
public float LifeTime = 1f;
|
||||
|
||||
float m_SpawnTime;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
m_SpawnTime = Time.time;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Time.time > m_SpawnTime + LifeTime)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user