Ejemplo n.º 1
0
    private void UpdateColors(ColorInput input)
    {
        CurrentColorInput = input;

        switch (input)
        {
        case ColorInput.None:
            Colorize(_player, LevelColors.Player);
            break;

        case ColorInput.Color1:
            Colorize(_player, LevelColors.Color1);
            break;

        case ColorInput.Color2:
            Colorize(_player, LevelColors.Color2);
            break;

        case ColorInput.ColorMixed:
            Colorize(_player, LevelColors.ColorMixed);
            break;

        default:
            throw new ArgumentOutOfRangeException("input", input, null);
        }

        SetState(_color1Blocks, input == ColorInput.Color1);
        SetState(_color2Blocks, input == ColorInput.Color2);
        SetState(_colorMixedBlocks, input == ColorInput.ColorMixed);
        SetState(_antiColor1Blocks, input != ColorInput.Color1);
        SetState(_antiColor2Blocks, input != ColorInput.Color2);
        SetState(_antiColorMixedBlocks, input != ColorInput.ColorMixed);
    }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        this.serializedObject.Update();

        ColorInput bridge = (ColorInput)target;

        GUI.enabled = false;
        EditorGUILayout.PropertyField(script, true, new GUILayoutOption[0]);
        GUI.enabled = true;
        EditorGUILayout.ColorField("Color", bridge.color);

        if (Application.isPlaying)
        {
            EditorUtility.SetDirty(target);
        }

        this.serializedObject.ApplyModifiedProperties();
    }