using System; using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; namespace Unity.BossRoom.Gameplay.GameplayObjects { public class DamageReceiver : NetworkBehaviour, IDamageable { public event Action DamageReceived; public event Action CollisionEntered; [SerializeField] NetworkLifeState m_NetworkLifeState; public void ReceiveHP(ServerCharacter inflicter, int HP) { if (IsDamageable()) { DamageReceived?.Invoke(inflicter, HP); } } public IDamageable.SpecialDamageFlags GetSpecialDamageFlags() { return IDamageable.SpecialDamageFlags.None; } public bool IsDamageable() { return m_NetworkLifeState.LifeState.Value == LifeState.Alive; } void OnCollisionEnter(Collision other) { CollisionEntered?.Invoke(other); } } }