void HandleMovementInput(PlayerMovementComponent move) { InputSingleton input = InputSingleton.GetLocalInputComponent(); if (input != null) { switch (move.State) { case MovementState.Idle: if (input.IsInputActivated()) { if (input.Jump) { ChangeXZVelocityByInput(move, input.InputAxis); move.EnterState(MovementState.Jump); } else if (input.InputAxis != Vector3.zero) { ChangeXZVelocityByInput(move, input.InputAxis); move.EnterState(MovementState.Move); } } break; case MovementState.Move: if (input.IsInputActivated()) { if (input.Jump) { ChangeXZVelocityByInput(move, input.InputAxis); move.EnterState(MovementState.Jump); } else { ChangeXZVelocityByInput(move, input.InputAxis); } } else { move.EnterState(MovementState.Idle); } break; case MovementState.Jump: ChangeXZVelocityByInput(move, input.InputAxis); if (move.cc.isGrounded && move.velocity.y < 0) { move.EnterState(MovementState.Idle); } break; default: Debug.LogError("HandleMovementInput: Uncaught movement system state"); break; } } }
public override void Update() { if (input == null) { input = InputSingleton.GetLocalInputComponent(); } if (input != null) { HandleLocalSkills(); } }
void HandleInput() { if (input == null) { input = InputSingleton.GetLocalInputComponent(); } if (input != null) { Vector3 inputAxis = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); inputAxis = Vector3.ClampMagnitude(inputAxis, 1.0f); input.InputAxis = inputAxis; input.Jump = Input.GetKeyDown(KeyCode.Space); input.MousePos = Input.mousePosition; input.Skills.Clear(); GetSkillInput(SkillEnum.Tower, KeyCode.F); } }
void Awake() { LocalInput = this; InitData(); }