/// <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); } } }
/// <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); } } }