JojikYT

State

Dec 18th, 2021 (edited)
3,415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.InputSystem;
  3.  
  4. public class State
  5. {
  6.     public Character character;
  7.     public StateMachine stateMachine;
  8.  
  9.     protected Vector3 gravityVelocity;
  10.     protected Vector3 velocity;
  11.     protected Vector2 input;
  12.  
  13.     public InputAction moveAction;
  14.     public InputAction lookAction;
  15.     public InputAction jumpAction;
  16.     public InputAction crouchAction;
  17.     public InputAction sprintAction;
  18.  
  19.     public State(Character _character, StateMachine _stateMachine)
  20.     {
  21.         character = _character;
  22.         stateMachine = _stateMachine;
  23.  
  24.         moveAction = character.playerInput.actions["Move"];
  25.         lookAction = character.playerInput.actions["Look"];
  26.         jumpAction = character.playerInput.actions["Jump"];
  27.         crouchAction = character.playerInput.actions["Crouch"];
  28.         sprintAction = character.playerInput.actions["Sprint"];
  29.  
  30.     }
  31.  
  32.     public virtual void Enter()
  33.     {
  34.         Debug.Log("enter state: "+this.ToString());
  35.     }
  36.  
  37.     public virtual void HandleInput()
  38.     {
  39.     }
  40.  
  41.     public virtual void LogicUpdate()
  42.     {
  43.     }
  44.  
  45.     public virtual void PhysicsUpdate()
  46.     {
  47.     }
  48.  
  49.     public virtual void Exit()
  50.     {
  51.     }
  52. }
  53.  
  54.  
Add Comment
Please, Sign In to add comment