public IEnumerator GreenState()
    {
        #region Sprite Colors
        for (int i = 0; i < colors.Length; i++)
        {
            if (colors[i].name == colorState.ToString())
            {
                if (playerAnimation.spriteRenderer.color != colors[i].primaryColor)
                {
                    GreenMovement M = colorScripts.greenMovement;
                    M.rb.velocity = new Vector2(M.rb.velocity.x, M.jumpForce);
                }

                playerAnimation.spriteRenderer.color = colors[i].primaryColor;
                playerAnimation.rimRenderer.color    = colors[i].secondaryColor;
            }
        }
        #endregion

        #region Looping
        while (colorState == ColorStates.Green)
        {
            yield return(0);
        }
        #endregion

        AutomateExit("Green");
    }
Exemple #2
0
    private void Update()
    {
        if (circleBar != null)
        {
            switch (playerStateMachine.colorState)
            {
            case ColorStates.Red:

                break;

                #region Yellow
            case ColorStates.Yellow:
                YellowMovement yellow = playerStateMachine.colorScripts.yellowMovement;

                if (yellow.circleFillAmount != circleBar.fillAmount)
                {
                    circleBar.fillAmount = yellow.circleFillAmount;
                    //print("reduced " + yellow.circleFillAmount);
                }

                circleBarText.text = "Stamina";     //! Optimise
                break;
                #endregion

                #region Green
            case ColorStates.Green:
                GreenMovement green = playerStateMachine.colorScripts.greenMovement;

                if (green.circleFillAmount != circleBar.fillAmount)
                {
                    circleBar.fillAmount = green.circleFillAmount;
                    print("reduced " + green.circleFillAmount);
                }

                circleBarText.text = "Stamina";     //! Optimise
                break;
                #endregion

                #region Blue
            case ColorStates.Blue:
                BlueMovement blue = playerStateMachine.colorScripts.blueMovement;

                if (blue.circleFillAmount != circleBar.fillAmount)
                {
                    circleBar.fillAmount = blue.circleFillAmount;
                    print("reduced " + blue.circleFillAmount);
                }

                circleBarText.text = "Time Scale: \n" + Time.timeScale;     //! Optimise
                break;
                #endregion

                #region Purple
            case ColorStates.Purple:
                PurpleMovement purple = playerStateMachine.colorScripts.purpleMovement;

                if (purple.circleFillAmount != circleBar.fillAmount)
                {
                    circleBar.fillAmount = purple.circleFillAmount;
                    print("reduced " + purple.circleFillAmount);
                }

                if (purple.rb.gravityScale < 0 && !circleBar.fillClockwise)
                {
                    circleBar.fillClockwise = true;
                }
                else if (purple.rb.gravityScale > 0 && circleBar.fillClockwise)
                {
                    circleBar.fillClockwise = false;
                }

                circleBarText.text = "Gravity Scale: \n" + purple.rb.gravityScale;     //! Optimise
                break;
                #endregion
            }
        }
    }