Esempio n. 1
0
 // Update display blocks and load previous settings
 void Start()
 {
     BlockUpdater.updateSprites();
     BlockUpdater.updateColors();
     dynamicColor.isOn = Settings.dynamicColor;
     moveDelay.value   = Settings.moveDelay * 100;
     moveSpeed.value   = Settings.moveSpeed * 100;
     fullScreen.isOn   = Screen.fullScreen;
 }
Esempio n. 2
0
 public void changeBlockColor(bool next)
 {
     if (next)
     {
         BlockUpdater.nextColorPallet();
     }
     else
     {
         BlockUpdater.prevColorPallet();
     }
     BlockUpdater.updateColors();
 }
Esempio n. 3
0
    // Shuffle Tetromino colors on first awake and load keybinds
    private void Awake()
    {
        // First awake. Not sure if this is necessary but just in case
        if (Time.time == 0)
        {
            BlockUpdater.shuffleColorPallet();
            Settings.fullScreen = Screen.fullScreen;  // Just set the settings to whatever the screen starts as
        }


        BlockUpdater.updateColors();
        BlockUpdater.updateSprites();

        //if (!false) {                // Check for saved player prefs here?
        Settings.keyBinds = new Dictionary <Board.PlayerInput, KeyCode>(Settings.defaultKeybinds);
        //}

        particleEffectMain            = particleEffect.main;
        particleEffectMain.startColor = new ParticleSystem.MinMaxGradient(titleText.fontSharedMaterial.GetColor(ShaderUtilities.ID_FaceColor));
    }
Esempio n. 4
0
    // Lerps from one color to another in a smooth animation
    private IEnumerator fadeColorPalletRoutine( )
    {
        uint[] pallet = BlockUpdater.currentPallet();

        float h, s, v;

        Color.RGBToHSV(Hex2Color(pallet[0]), out h, out s, out v);

        Color32 fontColor = Color.HSVToRGB(h, s * 3, v * 3);

        // Save Old Colors for Lerp
        Color32[] oldColors = new Color32[materials.Length];
        for (int i = 0; i < oldColors.Length; i++)
        {
            oldColors[i] = materials[i].color;
        }
        Color32 oldFontColor = uiFontPrefab.fontSharedMaterial.GetColor(ShaderUtilities.ID_FaceColor);

        // Slowly transition
        float lerp = 0;

        while (lerp <= 1)
        {
            uiFontPrefab.fontSharedMaterial.SetColor(ShaderUtilities.ID_FaceColor, Color32.Lerp(oldFontColor, fontColor, lerp));
            uiFontPrefab.fontSharedMaterial.SetColor(ShaderUtilities.ID_OutlineColor, Color32.Lerp(oldFontColor, fontColor, lerp));
            for (int i = 0; i < materials.Length; i++)
            {
                materials[i].SetColor("_Color", Color32.Lerp(oldColors[i], Hex2Color(pallet[i]), lerp));
            }

            lerp += dLerpRatio;
            yield return(new WaitForSeconds(colorTransitionDelay));
        }
        //

        BlockUpdater.updateColors();
    }