//Monster's health is reduced by player's attack, possibly switching to won state. internal void MonsterHurt() { if (feedback == null) { feedback = FindObjectOfType <combatFeedback>(); } if (!enemyAttackPhase) { health -= player.PlayerAttack(); Animator.Play("Hurt"); CheckDeath(); } else if (player.timeLeft.value > player.greenZone) { health -= 1; feedback.DamageSet(SetFeedback.PlayerCountered); Animator.Play("Hurt"); CheckDeath(); } else { feedback.DamageSet(SetFeedback.PlayerDodged); } MakeQuestion(); }
//Player was wrong or so slow, enemy gets an attack! internal override void EnemyAttack() { if (ArrowsFired) { return; } if (feedback == null) { feedback = FindObjectOfType <combatFeedback>(); } if (animator) { animator.Play("Attack"); } feedback.DamageSet(SetFeedback.PlayerHit); player.DamagePlayer(1); sprite.transform.localPosition = startingPosition; sprite.transform.localRotation = startingRotation; CheckDeath(true); CreateQuestion(); }
//Calculate player's damage and return it. internal float PlayerAttack() { if (feedback == null) { feedback = FindObjectOfType <combatFeedback>(); } float damage = attack; if (Timer > greenZone) { damage *= 2; feedback.DamageSet(SetFeedback.EnemyCrit); } else { feedback.DamageSet(SetFeedback.EnemyHit); } Timer = resetTime; return(damage); }
//Calculate player's damage and return it. internal float PlayerAttack() { if (feedback == null) { feedback = FindObjectOfType <combatFeedback>(); } abilities.attacking++; float damage = attackDamage; if (Frozen > 0) { if (Frozen > 1) { damage = attackDamage * critMod; feedback.DamageSet(SetFeedback.EnemyCrit); abilities.Crits++; } else { feedback.DamageSet(SetFeedback.EnemyHit); } if (Frozen < 3) { Frozen = 0; } return(damage); } if (Timer > greenZone) { damage *= critMod; feedback.DamageSet(SetFeedback.EnemyCrit); abilities.Crits++; } else { feedback.DamageSet(SetFeedback.EnemyHit); } return(damage); }