/* * Set the fighter in Blocking state. Play animations and sounds. */ public void Block() { // Do not let them block if they don't have any durability left. if (IsShieldBroken()) { // Could play an error sound here. return; } if (isBlocking || isAttacking || chargeUpTimer.IsRunning()) { return; } if (IsIdle() || IsMoving()) { PlaySound(shieldUpSound); shieldTime.StartTimer(); isBlocking = true; } }
/* * Begins the fighter charging up an attack. Performs logic around charging, * sets fighter state, and kicks off the charge animation. */ void StartChargingWeapon() { chargeUpTimer.StartTimer(); currentChargeUpTime = 0; animation.CrossFade(currentAttack.chargeAnimation.name, 0.1f); }