示例#1
0
        /// <summary>
        /// Instantly kills the BattleEntity
        /// </summary>
        public void Kill()
        {
            CurHP = 0;

            ClearAllStatuses();
            ClearStatModifiers();
            InterruptCommand();

            EntityDeathEvent?.Invoke(this);

            Debug.Log($"{Name} has fallen in battle!");
        }
示例#2
0
        public float TakeDamage(float damage)
        {
            if (Time.time - lastDamage <= 0.05f || !takingDamage)
            {
                return(health);
            }

            health -= damage;
            health  = Mathf.Clamp(health, health, maxHealth);
            if (health <= 0)
            {
                onEntityDied.Invoke(this);
            }

            onTakeDamage.Invoke(damage, health);
            lastDamage = Time.deltaTime;
            return(health);
        }