Exemplo n.º 1
0
    public override void Step(CharControlMotor player, float deltaTime)
    {
        player.HandleSlopeFactor(deltaTime);
        player.HandleFriction(deltaTime);
        player.HandleDeceleration(deltaTime);
        player.HandleGravity(deltaTime);
        player.HandleFall();


        ///* Controls the height of the playerspin ~Birb64 *///

        if (player.PlayerObject.transform.eulerAngles.z > 100 && player.PlayerObject.transform.eulerAngles.z < 180)
        {
            player.PlayerObject.GetComponent <PlayerMotor>().height = 0.012f * player.PlayerObject.transform.eulerAngles.z;
        }
        if (player.PlayerObject.transform.eulerAngles.z < 260 && player.PlayerObject.transform.eulerAngles.z > 180)
        {
            player.PlayerObject.GetComponent <PlayerMotor>().height = 0.012f * (180 - Mathf.Abs(player.PlayerObject.transform.eulerAngles.z - 180));
        }

        ///* Controls the width of the playerspin ~Birb64 *///
        if (player.PlayerObject.transform.eulerAngles.z > 30 && player.PlayerObject.transform.eulerAngles.z < 180)
        {
            player.PlayerObject.GetComponent <PlayerMotor>().wallExtents = 0.01f * player.PlayerObject.transform.eulerAngles.z;
        }
        if (player.PlayerObject.transform.eulerAngles.z < 330 && player.PlayerObject.transform.eulerAngles.z > 180)
        {
            player.PlayerObject.GetComponent <PlayerMotor>().wallExtents = 0.01f * (180 - Mathf.Abs(player.PlayerObject.transform.eulerAngles.z - 180));
        }
        else if (player.PlayerObject.transform.eulerAngles.z < 180 || player.PlayerObject.transform.eulerAngles.z > 260)
        {
            player.PlayerObject.GetComponent <PlayerMotor>().wallExtents = 0.02f;
        }

        if (player.grounded)
        {
            if (player.input.actionDown)
            {
                player.HandleJump();
            }
            else if (Mathf.Abs(player.velocity.x) < player.stats.minSpeedToUnroll)
            {
                player.state.ChangeState <WalkPlayerState>();
            }
        }
        else
        {
            player.state.ChangeState <JumpPlayerState>();
        }
    }
    public override void Step(CharControlMotor player, float deltaTime)
    {
        player.HandleDeceleration(deltaTime);
        player.HandleGravity(deltaTime);
        player.HandleFall();

        if (player.grounded && (Mathf.Sign(player.input.horizontal) != Mathf.Sign(player.direction)))
        {
            if (player.input.actionDown)
            {
                player.HandleJump();
            }
            else if ((Mathf.Abs(player.velocity.x) <= player.stats.turnSpeed) || player.input.horizontal == 0)
            {
                player.state.ChangeState <WalkPlayerState>();
            }
        }
        else
        {
            player.state.ChangeState <WalkPlayerState>();
        }
    }
Exemplo n.º 3
0
    public override void Step(CharControlMotor player, float deltaTime)
    {
        player.HandleSlopeFactor(deltaTime);
        player.HandleFriction(deltaTime);
        player.HandleDeceleration(deltaTime);
        player.HandleGravity(deltaTime);
        player.HandleFall();

        if (player.grounded)
        {
            if (player.input.actionDown)
            {
                player.HandleJump();
            }
            else if (Mathf.Abs(player.velocity.x) < player.stats.minSpeedToUnroll)
            {
                player.state.ChangeState <WalkPlayerState>();
            }
        }
        else
        {
            player.state.ChangeState <JumpPlayerState>();
        }
    }