// Run the player state according to the given argument
    void runState(states stateName)
    {
        // Scroll through all of the player states, and run the functions corresponding to the given state name
        switch (stateName)
        {
        // The default player state
        case states.DEFAULT:

            playerFunctions.playerMovement(Input.GetAxis(playerStats.axisHorizontal), 0f, playerStats.movementSpeed);
            playerFunctions.allignToSurface(.25f);
            playerFunctions.playerDash(Input.GetAxis(playerStats.axisHorizontal), 0f, Input.GetAxis(playerStats.buttonDash), playerStats.dashForce, playerStats.dashDampening, playerStats.worldTransform);
            playerFunctions.setInvulnerability(playerStats.playerMaterial, playerStats.invulnerabilityMaterial, false);

            if (playerFunctions.obstacleHitCheck())
            {
                playerState = states.HIT;
            }

            break;

        case states.HIT:

            playerFunctions.playerMovement(0f, -.5f, playerStats.movementSpeed);
            playerFunctions.allignToSurface(.25f);
            playerFunctions.setInvulnerability(playerStats.playerMaterial, playerStats.invulnerabilityMaterial, true);

            if (playerFunctions.checkPositionTrigger(-6.5f))
            {
                playerState = states.DEFAULT;
            }

            break;
        }
    }
Exemple #2
0
    // Run the player state according to the given argument
    void runState(states stateName)
    {
        // Scroll through all of the player states, and run the functions corresponding to the given state name
        switch (stateName)
        {
        // The default player state
        case states.DEFAULT:

            // Run the player movement function
            playerFunctions.playerMovement(playerStats.inputAxisHorizontal, playerStats.inputAxisVertical, playerStats.movementSpeed);

            // Run the player item pickup function
            playerFunctions.playerItemPickup(playerStats.inputButtonItemPickup, playerStats.isHolding);

            // Run the player item drop function
            playerFunctions.playerItemDrop(playerStats.inputButtonItemDrop, playerStats.isHolding);

            break;
        }
    }