24 lines
543 B
C#
24 lines
543 B
C#
using HurricaneVR.Framework.Components;
|
|
using UnityEngine;
|
|
|
|
public class DestroyedInstance : MonoBehaviour
|
|
{
|
|
public HVRDamageHandler handler;
|
|
public GameObject prefab;
|
|
public float timerToDestroyPrefab;
|
|
|
|
private void Awake()
|
|
{
|
|
handler = GetComponent<HVRDamageHandler>();
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
if (!handler) return;
|
|
if (handler.Life > 0) return;
|
|
|
|
var inst= Instantiate(prefab, transform.position, Quaternion.identity);
|
|
Destroy(inst, timerToDestroyPrefab);
|
|
}
|
|
}
|