Exemplo n.º 1
0
    // Fixed Update of the Player
    void FixedUpdate()
    {
        if (fullStop)
        {
            Rb2D.velocity = new Vector2(0, 0);
            return;
        }

        // Mistake Mechanics
        processMistakes();

        if (dead)
        {
            if (enemyCol != null)
            {
                for (int i = 0; i < enemyCol.Length; i++)
                {
                    enemyCol[i].enabled = true;
                }
            }

            if (diedInLiquid)
            {
                Rb2D.velocity = new Vector2(0, 0);
            }
            else
            {
                Rb2D.velocity = new Vector2(0, Rb2D.velocity.y);
            }
        }
        else
        {
            if (endless)
            {
                Rb2D.velocity = new Vector2(5, Rb2D.velocity.y);
            }
            else
            {
                MV.Horizontal_Velocity_Update(Rb2D);
            }

            // Check for player controlled jumps
            MV.Jump(Rb2D);

            // Tells the movement script to update his axis
            MV.UpdateAxis();
        }

        // Animate
        MV.Animate(Rb2D, dead);
    }