23 lines
690 B
C#
23 lines
690 B
C#
using BITKit.Entities.Player;
|
|
using UnityEngine;
|
|
namespace BITKit.Entities
|
|
{
|
|
public class EntityCamera : EntityPlayerComponent
|
|
{
|
|
[Header(Constant.Header.Components)]
|
|
public Behaviour aliveCamera;
|
|
public Behaviour deathCamera;
|
|
[Header(Constant.Header.Reference)]
|
|
[SerializeReference, SubclassSelector] public IReference _onSetAlive;
|
|
public override void OnAwake()
|
|
{
|
|
var heal = entity.Get<IHealth>();
|
|
heal.OnSetAlive += OnSetAlive;
|
|
}
|
|
private void OnSetAlive(bool alive)
|
|
{
|
|
aliveCamera.enabled = alive;
|
|
deathCamera.enabled = alive is false;
|
|
}
|
|
}
|
|
} |