Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PlayerIdleState : PlayerBaseState
- {
- public PlayerIdleState(PlayerStateMachine currentContext,
- PlayerStateFactory playerStateFactory)
- : base(currentContext, playerStateFactory) { }
- public override void EnterState() {
- Ctx.PlayerMovementX = 0;
- Ctx.PlayerMovementZ = 0;
- //animation
- Ctx.AnimCon.SetFloat(Ctx.HorizontalAnim, 0);
- Ctx.AnimCon.SetFloat(Ctx.VerticalAnim, 0);
- }
- public override void UpdateState() {
- CheckSwitchStates();
- }
- public override void ExitState() { }
- public override void InitializeSubState() { }
- public override void CheckSwitchStates() {
- if (Ctx.InputMoveX != 0 || Ctx.InputMoveY != 0) {
- if (Ctx.InputRun)
- {
- SwitchState(Factory.Run());
- }
- else {
- SwitchState(Factory.Walk());
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment