예제 #1
0
    public virtual void RecieveDamage(int damage, Entity subject)
    {
        CurrentHP -= (int)(damageRecieveCoef * damage);

        OnDamagedAmount?.Invoke((int)(damageRecieveCoef * damage), MaxHP, subject);
        OnHpModified?.Invoke((float)CurrentHP / MaxHP);
        if (CurrentHP <= 0)
        {
            CurrentHP = 0;
            OnZeroHP?.Invoke();
        }
    }
예제 #2
0
 void Start()
 {
     OnHpModified?.Invoke((float)CurrentHP / MaxHP);
 }
예제 #3
0
 // Start is called before the first frame update
 private void Awake()
 {
     entity         = GetComponent <Entity>();
     entity.OnInit += () => { MaxHP = entity.Data.MaxHP; CurrentHP = MaxHP; OnHpModified?.Invoke((float)CurrentHP / MaxHP); };
 }