private void SwitchOnLSword(PlayerAttackManager.AttackState newAttackState) { switch (newAttackState) { case PlayerAttackManager.AttackState.Ranged: break; case PlayerAttackManager.AttackState.N1: sk_an.AnimationState.SetAnimation(0, "LSwordString1", false); break; case PlayerAttackManager.AttackState.N2: sk_an.AnimationState.SetAnimation(0, "LSwordString2", false); break; case PlayerAttackManager.AttackState.N3: sk_an.AnimationState.SetAnimation(0, "LSwordString3", false); break; case PlayerAttackManager.AttackState.N4: sk_an.AnimationState.SetAnimation(0, "LSwordString4", false); break; case PlayerAttackManager.AttackState.N5: sk_an.AnimationState.SetAnimation(0, "LSwordString5", false); break; default: throw new NotImplementedException("This attack animation sub-state is not yet configured!"); } }
private void SwitchOnWarhammer(PlayerAttackManager.AttackState newAttackState) { switch (newAttackState) { case PlayerAttackManager.AttackState.N1: sk_an.AnimationState.SetAnimation(0, "AxeString1", false); break; case PlayerAttackManager.AttackState.N2: sk_an.AnimationState.SetAnimation(0, "AxeString2", false); break; default: throw new NotImplementedException("This attack animation sub-state is not yet configured!");; } }
public void RunAnimationStateMachine() { switch (CurrentAnimationState) { case AnimState.Idle: if (plr.CurrentState == BaseController.State.Ready) { if (mc.MoveVector.x != 0) { ChangeToRunState(); } if (!mc.IsGrounded && !CloseToGround) { ChangeToFallState(); } } else if (plr.CurrentState == BaseController.State.Action) { if (plr.CurrentAction == PlayerController.Action.Rolling) { ChangeToRollState(); } else if (plr.CurrentAction == PlayerController.Action.Attacking) { ChangeToAttackState(); } } break; case AnimState.Run: if (plr.CurrentState == BaseController.State.Ready) { if (mc.MoveVector.x == 0) { ChangeToIdleState(); } if (!mc.IsGrounded && !CloseToGround) { ChangeToFallState(); } } else if (plr.CurrentState == BaseController.State.Action) { if (plr.CurrentAction == PlayerController.Action.Rolling) { ChangeToRollState(); } else if (plr.CurrentAction == PlayerController.Action.Attacking) { ChangeToAttackState(); } } break; case AnimState.RunHeavy: if (plr.CurrentState == BaseController.State.Ready) { if (mc.MoveVector.x == 0) { ChangeToIdleState(); } if (!mc.IsGrounded && !CloseToGround) { ChangeToFallState(); } } else if (plr.CurrentState == BaseController.State.Action) { if (plr.CurrentAction == PlayerController.Action.Rolling) { ChangeToRollState(); } else if (plr.CurrentAction == PlayerController.Action.Attacking) { ChangeToAttackState(); } } break; case AnimState.Fall: if (plr.CurrentState == BaseController.State.Ready) { if (mc.IsGrounded && mc.MoveVector.x != 0) { ChangeToRunState(); } if (mc.IsGrounded) { ChangeToIdleState(); } } else if (plr.CurrentState == BaseController.State.Action) { if (plr.CurrentAction == PlayerController.Action.Rolling) { ChangeToRollState(); } if (plr.CurrentAction == PlayerController.Action.Attacking) { ChangeToAttackState(); } } break; case AnimState.Rolling: if (plr.CurrentState != BaseController.State.Action || plr.CurrentAction != PlayerController.Action.Rolling) { ChangeToIdleState(); } break; case AnimState.Attacking: if (plr.CurrentState != BaseController.State.Action || plr.CurrentAction != PlayerController.Action.Attacking) { ChangeToIdleState(); } var newAttackState = am.AtkState; if (previousAttackState != newAttackState && newAttackState != PlayerAttackManager.AttackState.None) { if (newAttackState == PlayerAttackManager.AttackState.Ranged) { sk_an.AnimationState.SetAnimation(0, "BowFirstShot", false); } else if (newAttackState == PlayerAttackManager.AttackState.Aerial) { sk_an.AnimationState.SetAnimation(0, "AirAttack", false); sk_an.AnimationState.AddAnimation(0, "Jump", true, 0); } else { switch (am.MeleeWeapon.Type) { case MeleeWeaponItem.WeaponType.LightSword: SwitchOnLSword(newAttackState); break; case MeleeWeaponItem.WeaponType.Mace: SwitchOnMace(newAttackState); break; case MeleeWeaponItem.WeaponType.Warhammer: SwitchOnWarhammer(newAttackState); break; default: throw new NotImplementedException("This attack animation type is not yet configured!"); } } } previousAttackState = newAttackState; break; default: throw new NotImplementedException("This animation state is not yet configured"); } }