JojikYT

LandingState

Dec 18th, 2021 (edited)
2,374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class LandingState:State
  4. {
  5.     float timePassed;
  6.     float landingTime;
  7.  
  8.     public LandingState(Character _character, StateMachine _stateMachine) : base(_character, _stateMachine)
  9.     {
  10.         character = _character;
  11.         stateMachine = _stateMachine;
  12.     }
  13.  
  14.     public override void Enter()
  15.     {
  16.         base.Enter();
  17.         timePassed = 0f;
  18.         character.animator.SetTrigger("land");
  19.         landingTime = 0.5f;
  20.     }
  21.  
  22.     public override void LogicUpdate()
  23.     {
  24.        
  25.         base.LogicUpdate();
  26.         if (timePassed> landingTime)
  27.         {
  28.             character.animator.SetTrigger("move");
  29.             stateMachine.ChangeState(character.standing);
  30.         }
  31.         timePassed += Time.deltaTime;
  32.     }
  33.  
  34.  
  35.  
  36. }
  37.  
  38.  
Add Comment
Please, Sign In to add comment