30 lines
596 B
C#
30 lines
596 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BITKit;
|
|
using BITKit.Entities;
|
|
using UnityEngine;
|
|
|
|
namespace BITFALL.Props
|
|
{
|
|
public class Prop_Destroyable : EntityBehavior
|
|
{
|
|
[Inject] private IHealth _health;
|
|
[SerializeField] private Transform model;
|
|
[SerializeField] private Transform destroyedModel;
|
|
public override void OnStart()
|
|
{
|
|
base.OnStart();
|
|
_health.OnSetAlive += OnSetAlive;
|
|
}
|
|
|
|
private void OnSetAlive(bool obj)
|
|
{
|
|
if (model)
|
|
model.gameObject.SetActive(obj);
|
|
if (destroyedModel)
|
|
destroyedModel.gameObject.SetActive(!obj);
|
|
}
|
|
}
|
|
|
|
}
|