PappaP

PlayerMovement.cs Excerpt

Apr 8th, 2020
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1.     void Update()
  2.     {
  3.         //is the player in interact
  4.  
  5.         if (currentState == PlayerState.interact)
  6.         {
  7.             return; //just return if we are in interact
  8.         }
  9.  
  10.         change = Vector3.zero;
  11.  
  12.         change.x = Input.GetAxisRaw("Horizontal");
  13.         change.y = Input.GetAxisRaw("Vertical");
  14.  
  15.         if (Input.GetButtonDown("attack") && currentState != PlayerState.attack
  16.             && currentState != PlayerState.stagger)
  17.         {
  18.             Debug.Log("Attack!");
  19.             StartCoroutine(AttackCo());
  20.         }
  21.         else if (Input.GetButtonDown("Second Weapon") && currentState != PlayerState.attack
  22.             && currentState != PlayerState.stagger)
  23.             {
  24.             StartCoroutine(SecondAttackCo());
  25.             }
  26.     }
  27.  
  28.     private void FixedUpdate()
  29.     {
  30.        
  31.    
  32.         if(currentState == PlayerState.walk || currentState == PlayerState.idle)
  33.             {
  34.                 UpdateAnimationAndMove();
  35.             }
  36.        
  37.        
  38.     }
Add Comment
Please, Sign In to add comment