Example #1
0
 private void HandleInputOnce(PlayerInputData inputData)
 {
     if (inputData.inputTokens[8]) // Light
     {
         inputData.EatInputToken(8);
         if (playerController.playerCharacterData.GetPrimaryWeapon() != WeaponType.NONE)
         {
             stateMachine.ChangeState(playerController.lightActionState);
         }
     }
     else if (inputData.inputTokens[9]) // Medium
     {
         inputData.EatInputToken(9);
         if (playerController.playerCharacterData.GetPrimaryWeapon() != WeaponType.NONE)
         {
             stateMachine.ChangeState(playerController.mediumActionState);
         }
     }
     else if (inputData.inputTokens[10]) // Heavy
     {
         inputData.EatInputToken(10);
         if (playerController.playerCharacterData.GetPrimaryWeapon() != WeaponType.NONE)
         {
             stateMachine.ChangeState(playerController.heavyActionState);
         }
     }
 }
 private void HandleInputOnce(PlayerInputData inputData)
 {
     if (inputData.inputTokens[6]) // Jump
     {
         inputData.EatInputToken(6);
         if (AdvancedMovement.CanStand(movementController)) // If can stand
         {
             if (!movementController.IsAirborne())
             {
                 stateMachine.ChangeState(playerController.jumpingState);
             }
         }
     }
     else if (inputData.inputTokens[3]) // Crouch
     {
         inputData.EatInputToken(3);
         if (!movementController.IsAirborne())
         {
             stateMachine.ChangeState(playerController.crouchingState);
         }
         else
         {
             stateMachine.ChangeState(playerController.fallingState);
         }
     }
 }
Example #3
0
    private void HandleInputOnce(PlayerInputData inputData)
    {
        WeaponType primaryWeapon = playerController.playerCharacterData.GetPrimaryWeapon();

        if (inputData.inputTokens[8]) // Light
        {
            inputData.EatInputToken(8);
            if (primaryWeapon != WeaponType.NONE)
            {
                stateMachine.ChangeState(playerController.lightActionState);
            }
        }
        else if (inputData.inputTokens[9]) // Medium
        {
            inputData.EatInputToken(9);
            if (primaryWeapon != WeaponType.NONE)
            {
                stateMachine.ChangeState(playerController.mediumActionState);
            }
        }
        else if (inputData.inputTokens[10]) // Heavy
        {
            inputData.EatInputToken(10);
            if (primaryWeapon != WeaponType.NONE)
            {
                stateMachine.ChangeState(playerController.heavyActionState);
            }
        }
        else if (inputData.inputTokens[6]) // Jump
        {
            inputData.EatInputToken(6);
            if (AdvancedMovement.CanStand(movementController)) // If can stand
            {
                IState prevState = stateMachine.PeekPreviousState();
                if (prevState == playerController.crouchingState)
                {
                    // If prev state was crouching, skip airborne check
                    stateMachine.ChangeState(playerController.jumpingState);
                }
                else if (!movementController.IsAirborne())
                {
                    stateMachine.ChangeState(playerController.jumpingState);
                }
            }
        }
        else if (inputData.inputTokens[3]) // Crouch
        {
            inputData.EatInputToken(3);
            if (!movementController.IsAirborne())
            {
                stateMachine.ChangeState(playerController.crouchingState);
            }
            else
            {
                stateMachine.ChangeState(playerController.fallingState);
            }
        }
    }
Example #4
0
 private void HandleInputOnce(PlayerInputData inputData)
 {
     if (inputData.inputTokens[6]) // Jump
     {
         inputData.EatInputToken(6);
         stateMachine.ChangeState(playerController.slidingJumpState);
     }
 }
 private void PollSwitchWeapon()
 {
     if (playerInputData.inputTokens[11])
     {
         playerInputData.EatInputToken(11);
         if (canSwitchWeapon)
         {
             playerCharacterData.SwapWeapons();
             weapons.UpdateWeaponSprite();
             canSwitchWeapon   = false;
             switchWeaponTimer = 0d;
         }
     }
 }
Example #6
0
 private void HandleInputOnce(PlayerInputData inputData)
 {
     if (inputData.inputTokens[8]) // Light
     {
         inputData.EatInputToken(8);
         if (playerController.playerCharacterData.GetPrimaryWeapon() != WeaponType.NONE)
         {
             stateMachine.ChangeState(playerController.lightActionState);
         }
     }
     else if (inputData.inputTokens[9]) // Medium
     {
         inputData.EatInputToken(9);
         if (playerController.playerCharacterData.GetPrimaryWeapon() != WeaponType.NONE)
         {
             stateMachine.ChangeState(playerController.mediumActionState);
         }
     }
     else if (inputData.inputTokens[10]) // Heavy
     {
         inputData.EatInputToken(10);
         if (playerController.playerCharacterData.GetPrimaryWeapon() != WeaponType.NONE)
         {
             stateMachine.ChangeState(playerController.heavyActionState);
         }
     }
     else if (inputData.inputTokens[5]) // Guard
     {
         inputData.EatInputToken(5);
         stateMachine.ChangeState(playerController.standingGuardState);
     }
     else if (inputData.inputTokens[6]) // Jump
     {
         inputData.EatInputToken(6);
         stateMachine.ChangeState(playerController.jumpingState);
     }
     else if (inputData.inputTokens[3]) // Crouch
     {
         inputData.EatInputToken(3);
         stateMachine.ChangeState(playerController.crouchingState);
     }
     else if (inputData.inputTokens[7]) // Dash
     {
         inputData.EatInputToken(7);
         stateMachine.ChangeState(playerController.dashingState);
     }
 }
 private void HandleInputOnce(PlayerInputData inputData)
 {
     if (inputData.inputTokens[8]) // Light
     {
         inputData.EatInputToken(8);
         if (playerController.playerCharacterData.GetPrimaryWeapon() != WeaponType.NONE)
         {
             stateMachine.ChangeState(playerController.lightActionState);
         }
     }
     else if (inputData.inputTokens[9]) // Medium
     {
         inputData.EatInputToken(9);
         if (playerController.playerCharacterData.GetPrimaryWeapon() != WeaponType.NONE)
         {
             stateMachine.ChangeState(playerController.mediumActionState);
         }
     }
     else if (inputData.inputTokens[10]) // Heavy
     {
         inputData.EatInputToken(10);
         if (playerController.playerCharacterData.GetPrimaryWeapon() != WeaponType.NONE)
         {
             stateMachine.ChangeState(playerController.heavyActionState);
         }
     }
     else if (inputData.inputTokens[7]) // Dash
     {
         inputData.EatInputToken(7);
         if (playerController.canAirDash)
         {
             stateMachine.ChangeState(playerController.dashingState);
         }
     }
     else if (inputData.inputTokens[6]) // Jump
     {
         inputData.EatInputToken(6);
         if (stateMachine.PeekPreviousState() == playerController.slidingState)
         {
             // coyote jump but with sliding
             if (timeInSeconds < GameConstants.SLIDE_JUMP_BUFFER)
             {
                 if (AdvancedMovement.CheckSlideFar(movementController))
                 {
                     stateMachine.ChangeState(playerController.slidingJumpState);
                 }
                 else
                 {
                     BasicMovement.TurnAround(movementController);
                     stateMachine.ChangeState(playerController.slidingJumpState);
                 }
             }
         }
         else if (stateMachine.PeekPreviousState() == playerController.movingState)
         {
             if (timeInSeconds < GameConstants.COYOTE_JUMP_DELAY)
             {
                 stateMachine.ChangeState(playerController.jumpingState);
             }
         }
         else // Previous state was NOT moving state or sliding state
         {
             playerController.jumpBufferTimer = 0d; // Reset the timer
             playerController.jumpInputBuffer = true; // Buffer the jump command
         }
     }
 }