Ejemplo n.º 1
0
    private void Movement()
    {
        playerStats.yVelocity = playerJumpScr.GetYVel();
        Vector2 movementDirection;

        if (playerStats.beforeWall)
        {
            if (playerStats.isDashing)
            {
                movementDirection = new Vector2(0, 0);
            }
            else
            {
                movementDirection = new Vector2(0, playerStats.yVelocity);
            }
        }
        else
        {
            if (playerStats.isDashing)
            {
                movementDirection = new Vector2(playerStats.dashSpeed * playerStats.lookDirection, 0);
            }
            else
            {
                movementDirection = new Vector2(playerStats.movementSpeed * playerStats.lookDirection, playerStats.yVelocity);
            }
        }
        rb.velocity = movementDirection;
    }