コード例 #1
0
 public override void Update()
 {
     base.Update();
     if (Controller.State.IsGrounded && !justJumped)
     {
         Controller.SetHorizontalForce(0);
     }
     if (justJumped)
     {
         justJumped = false;
     }
 }
コード例 #2
0
 public void OnBeat(float timeOfBeat, float a)
 {
     if (currentState != AIState.Idle && Controller.State.IsGrounded)
     {
         float speed = 0;
         if (currentState == AIState.Chasing)
         {
             speed = parameters.MaxSpeedChasing;
         }
         else
         {
             speed = parameters.MaxSpeedFighting;
         }
         float normalizedHorizontalSpeed = (player.transform.position.x > transform.position.x) ? 1 : -1;
         Controller.SetHorizontalForce(speed * normalizedHorizontalSpeed);
         Controller.Jump();
         justJumped = true;
     }
 }