Example #1
0
 public override void Exit()
 {
     base.Exit();
     if (SwordCharacter.CurrentVelocity.y > 0)
     {
         SwordCharacter.SetVelocityY(SwordCharacter.CurrentVelocity.y * SwordCharacterData.DashEndYMultiplier);
     }
 }
 public override void Enter()
 {
     base.Enter();
     SwordCharacter.InputHandler.JumpButtonUsed();
     SwordCharacter.SetVelocityY(SwordCharacterData.JumpVelocity);
     IsAbilityDone = true;
     _amountsOfJumpsLeft--;
     SwordCharacter.AirState.SetIsJumping();
 }
Example #3
0
    public override void LogicUpdate()
    {
        base.LogicUpdate();
        if (isExitingState)
        {
            return;
        }

        SwordCharacter.SetVelocityY(-SwordCharacterData.WallSlideVelocity);
        if (GrabInput && IsTouchingGrabbable)
        {
            SwordCharaterStateMachine.ChangeState(SwordCharacter.WallGrabState);
        }
    }
 private void CheckJumpMultiplier()
 {
     if (_isJumping)
     {
         if (_jumpInputStop)
         {
             SwordCharacter.SetVelocityY(SwordCharacter.CurrentVelocity.y * SwordCharacterData.JumpHeightMultiplier);
             _isJumping = false;
         }
         else if (SwordCharacter.CurrentVelocity.y <= 0f)
         {
             _isJumping = false;
         }
     }
 }
    public override void LogicUpdate()
    {
        base.LogicUpdate();
        if (isExitingState)
        {
            return;
        }

        if (YInput > 0 && IsTouchingGrabbable && GrabInput)
        {
            SwordCharacter.SetVelocityY(SwordCharacterData.WallClimbVelocity);
        }
        if (YInput < 0 && IsTouchingGrabbable && GrabInput)
        {
            SwordCharacter.SetVelocityY(-SwordCharacterData.WallClimbVelocity);
        }

        if (YInput == 0 && IsTouchingGrabbable && GrabInput || IsTouchingWallAbove && YInput > 0)
        {
            SwordCharaterStateMachine.ChangeState(SwordCharacter.WallGrabState);
        }
        //If player hold down while grabbing, it should stands idle
        else if (YInput < 0 && IsTouchingGrabbable && GrabInput && IsGrounded)
        {
            SwordCharaterStateMachine.ChangeState(SwordCharacter.IdleState);
        }
        //Smooth transition between climb and slide
        else if ((IsTouchingGrabbable || IsTouchingWall) && !GrabInput && XInput == SwordCharacter.FacingDirection)
        {
            SwordCharaterStateMachine.ChangeState(SwordCharacter.WallSlideState);
        }
        //If none of it is true just release from wall
        else if (!IsTouchingGrabbable)
        {
            SwordCharaterStateMachine.ChangeState(SwordCharacter.AirState);
        }
    }