unity-atoms/Examples/Assets/InfinityWaves/Projectile/DestroyMe.cs

24 lines
438 B
C#
Raw Normal View History

2020-03-04 18:48:39 -05:00
using UnityEngine;
using UnityEngine.Assertions;
using UnityAtoms.BaseAtoms;
public class DestroyMe : MonoBehaviour
{
[SerializeField]
2020-03-11 16:11:27 -04:00
FloatReference _delay = new FloatReference(-1f);
2020-03-04 18:48:39 -05:00
void Start()
{
Assert.IsNotNull(_delay);
2020-03-11 16:11:27 -04:00
if (_delay.Value >= 0f)
{
Destroy(gameObject, _delay.Value);
}
2020-03-04 18:48:39 -05:00
}
public void DestroyImmediate()
{
Destroy(gameObject);
}
}