Aetheria/Assets/Scripts/Gameplay/TimedDestroy.cs
Reinier Vens 11a55e236b Loot
Fixed: unable to undock with an aetheric drive (game requires locomotion)
Entities have a chance of dropping any item on board when killed
Mine behavior generalized to grid objects, used in dropped loot
Added tractor beam (not itemized yet) which pulls in nearby loot (and mines!)
Items are added to player inventory when they collide with the ship (and mines explode!)
Added console command to spawn turret
2021-04-15 04:25:22 +01:00

19 lines
No EOL
312 B
C#

using System;
using UnityEngine;
public class TimedDestroy : MonoBehaviour
{
public float Duration;
private float _startTime;
private void Start()
{
_startTime = Time.time;
}
public void Update()
{
if(Time.time - _startTime > Duration) Destroy(gameObject);
}
}