示例#1
0
        /// <summary>
        /// Tells the AI that it got hit and it will subtract the amount of health passed from its' total health
        /// </summary>
        public void GotHit(float damage)
        {
            // We don't want to enable this state if the FSM is dead
            GotHitState gotHitState = GetState <GotHitState>();

            if (gotHitState != null && gotHitState.CanGetHit(this))
            {
                SubtractHealthValue(damage * GetDamageMultiplier());

                if (gotHitState.CoolDownFinished())
                {
                    ChangeActiveState(gotHitState);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Tells the AI that it got hit and it will subtract the amount of health passed from its' total health
        /// </summary>
        public void Damage(float damage)
        {
            // We don't want to enable this state if the FSM is dead
            GotHitState gotHitState = GetState <GotHitState>();

            if (gotHitState != null && gotHitState.CanGetHit(this))
            {
                float totalDamage = damage * GetDamageMultiplier();
                SubtractHealthValue(totalDamage);
                Debug.Log("Got " + totalDamage + " damage");

                if (gotHitState.CoolDownFinished())
                {
                    ChangeActiveState(gotHitState);
                }
            }
        }