// Use this for initialization
    void Start()
    {
        if (gm == null)
        {
            gm = gameObject.GetComponent <GameManagerTiroLibre>();
        }

        //currentBallStartPosition = ball.transform.position;

        currentTime = totalTime;
        timeMillis  = 1000f;

        remainingRepetitions = totalRepetitions;

        frontPlane        = new LegMovements[] { LegMovements.FrontLeftLeg, LegMovements.FrontRightLeg };
        backPlane         = new LegMovements[] { LegMovements.BackLeftLeg, LegMovements.BackRightLeg };
        random            = new System.Random();
        lastLegMovement   = false;
        lastShiftMovement = false;
        currentPlatform   = ShiftPlatforms.CenterPlatform;

        if (PlaylistManager.pm == null || (PlaylistManager.pm != null && !PlaylistManager.pm.active)) // playlist active check
        {
            mainPanel.SetActive(false);
            parametersPanel.SetActive(true);
        }

        //StartGame();
    }
    public void NextShiftMovement()
    {
        frontLeftLegPanel.SetActive(false);
        frontRightLegPanel.SetActive(false);
        backLeftLegPanel.SetActive(false);
        backRightLegPanel.SetActive(false);
        leftLegParticles1.Stop();
        leftLegParticles2.Stop();
        rightLegParticles1.Stop();
        rightLegParticles2.Stop();

        ShiftPlatforms lastPlatform = currentPlatform;

        if (lastShiftMovement)
        {
            currentPlatform   = ShiftPlatforms.CenterPlatform;
            lastShiftMovement = false;
        }
        else
        {
            ArrayList values = new ArrayList(Enum.GetValues(typeof(ShiftPlatforms)));
            values.Remove(ShiftPlatforms.CenterPlatform);
            currentPlatform   = (ShiftPlatforms)values[(random.Next(values.Count))];
            lastShiftMovement = true;
        }

        if (currentPlatform == ShiftPlatforms.LeftPlatform)
        {
            shiftLeftPanel.SetActive(true);
        }
        else if (currentPlatform == ShiftPlatforms.RightPlatform)
        {
            shiftRightPanel.SetActive(true);
        }
        else if (lastPlatform == ShiftPlatforms.LeftPlatform)
        {
            shiftRightPanel.SetActive(true);
        }
        else if (lastPlatform == ShiftPlatforms.RightPlatform)
        {
            shiftLeftPanel.SetActive(true);
        }

        avatarPlatform.SetActive(true);

        switch (currentPlatform)
        {
        case ShiftPlatforms.LeftPlatform:
        {
            leftShiftPlatform.SetActive(true);
            centerShiftPlatform.SetActive(false);
            rightShiftPlatform.SetActive(false);
            //currentBallStartPosition.x = leftShiftPlatform.transform.position.x;
            break;
        }

        case ShiftPlatforms.CenterPlatform:
        {
            leftShiftPlatform.SetActive(false);
            centerShiftPlatform.SetActive(true);
            rightShiftPlatform.SetActive(false);
            //currentBallStartPosition.x = centerShiftPlatform.transform.position.x;
            break;
        }

        case ShiftPlatforms.RightPlatform:
        {
            leftShiftPlatform.SetActive(false);
            centerShiftPlatform.SetActive(false);
            rightShiftPlatform.SetActive(true);
            //currentBallStartPosition.x = rightShiftPlatform.transform.position.x;
            break;
        }

        default:
            break;
        }

        lastLegMovement = false;
        EnableMovement(true);
    }