Exemplo n.º 1
0
    private void SetInitialColors(ColorType ColorType, ColorHue ColorHue)
    {
        if (ColorType == ColorType.Primary)
        {
            // Setting Player Color
            int ColorIndex = ReturnColorInt(ColorHue);
            if (ColorIndex < 0)
            {
                ColorIndex = Random.Range(0, 3);
            }
            _secondaryColor = _primaryColorArray[ColorIndex];

            switch (ColorIndex)
            {
                case 0:
                    _currentColor = "Red";
                    break;
                case 1:
                    _currentColor = "Yellow";
                    break;
                case 2:
                    _currentColor = "Blue";
                    break;
            }
        }
        else if (ColorType == ColorType.Secondary)
        {
            // Setting Player Color
            int ColorIndex = ReturnColorInt(ColorHue);
            if (ColorIndex < 0) {
                ColorIndex = Random.Range(0, 3);
            }
            _secondaryColor = _secondaryColorArray[ColorIndex];

            switch (ColorIndex)
            {
                case 0:
                    _currentColor = "Green";
                    break;
                case 1:
                    _currentColor = "Purple";
                    break;
                case 2:
                    _currentColor = "Orange";
                    break;
            }
        }
        else if (ColorType == ColorType.Swapper) {
            // Setting Player Color
            _swapperColorIndex++;

            if (_swapperColorIndex > 2) {
                _swapperColorIndex = 0;
            }

            _secondaryColor = _secondaryColorArray[_swapperColorIndex];

            switch (_swapperColorIndex)
            {
                case 0:
                    _currentColor = "Green";
                    break;
                case 1:
                    _currentColor = "Purple";
                    break;
                case 2:
                    _currentColor = "Orange";
                    break;
            }

            Debug.Log(_secondaryColor);
        }
        else
        {
            // Setting Player Color
            _secondaryColor = _whiteColor;
            _currentColor = "White";
        }

        foreach (GameObject x in _objectSprites)
        {
            x.GetComponent<SpriteRenderer>().color = _secondaryColor;
        }
    }
Exemplo n.º 2
0
 public int ReturnColorInt(ColorHue ColorHue)
 {
     switch (ColorHue) {
         case ColorHue.Red:
             return 0;
         case ColorHue.Yellow:
             return 1;
         case ColorHue.Blue:
             return 2;
         case ColorHue.Green:
             return 0;
         case ColorHue.Purple:
             return 0;
         case ColorHue.Orange:
             return 1;
         case ColorHue.Random:
             return -1;
     }
     return -1;
 }