JojikYT

State

Feb 10th, 2022 (edited)
4,885
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.47 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.     public InputAction drawWeaponAction;
  19.     public InputAction attackAction;
  20.  
  21.     public State(Character _character, StateMachine _stateMachine)
  22.     {
  23.         character = _character;
  24.         stateMachine = _stateMachine;
  25.  
  26.         moveAction = character.playerInput.actions["Move"];
  27.         lookAction = character.playerInput.actions["Look"];
  28.         jumpAction = character.playerInput.actions["Jump"];
  29.         crouchAction = character.playerInput.actions["Crouch"];
  30.         sprintAction = character.playerInput.actions["Sprint"];
  31.         drawWeaponAction = character.playerInput.actions["DrawWeapon"];
  32.         attackAction = character.playerInput.actions["Attack"];
  33.  
  34.     }
  35.  
  36.     public virtual void Enter()
  37.     {
  38.         //StateUI.instance.SetStateText(this.ToString());
  39.         Debug.Log("Enter State: "+this.ToString());
  40.     }
  41.  
  42.     public virtual void HandleInput()
  43.     {
  44.     }
  45.  
  46.     public virtual void LogicUpdate()
  47.     {
  48.     }
  49.  
  50.     public virtual void PhysicsUpdate()
  51.     {
  52.     }
  53.  
  54.     public virtual void Exit()
  55.     {
  56.     }
  57. }
  58.  
  59.  
Advertisement
Add Comment
Please, Sign In to add comment