Files
OnlyNPC/Assets/FPS/Scripts/Game/TimedSelfDestruct.cs
manhduyhoang90 167a617e09 asdasd
2026-05-26 09:46:57 +07:00

24 lines
417 B
C#

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);
}
}
}
}