예제 #1
0
    private void Start()
    {
        ColorScriptableObject colorList = GameConstants.Current.ColorList;
        Color color = colorList.colors[colorID];

        spriteRenderer.color = color;
    }
예제 #2
0
 void Awake()
 {
     //Add ColorEditor to ScriptableColorObject
     if (ScriptableColorObject == null)
     {
         ScriptableColorObject = AssetDatabase.LoadAssetAtPath <ColorScriptableObject>("Assets/Scriptable Object/ColorEditor.asset");
     }
     trackedObjects.Add(this);
 }
예제 #3
0
    //Update the list of objects with the Mass Color Change
    static public void UpdateButtonColor(ColorScriptableObject cso = null)
    {
        foreach (MassColorChange itemToChange in trackedObjects)
        {
            if (itemToChange == null)
            {
                continue;
            }

            itemToChange.ApplyColorChange(cso);
        }
    }
예제 #4
0
    private void Awake()
    {
        //load all genes from resources
        m_ColorGene = Resources.Load <ColorScriptableObject>(GeneResourcePath + "Color");

        m_Genes.AddRange(Resources.LoadAll <GeneScriptableObject>(GeneResourcePath));

        FetchGeneTypes();

        PickGenes(m_GenesPerCharacter);

        FetchAndInitAliens();

        SetDominantGenesAvailableText(m_DominantGenesAvailable);

        m_VictoryUI = GameObject.FindGameObjectWithTag("VictoryUI").GetComponent <VictoryUI>();
    }
예제 #5
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        ColorScriptableObject myScript = (ColorScriptableObject)target;

        GUILayout.Label("After you press Update, you need to interact with another \n setting to see the changes.");
        if (GUILayout.Button("Update All"))
        {
            MassColorChange.UpdateButtonColor(myScript);
            Repaint();
            AssetDatabase.SaveAssets();
            EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
        }
        if (GUILayout.Button("Reload Scene"))
        {
            Scene current = EditorSceneManager.GetActiveScene();
            EditorSceneManager.OpenScene(current.path);
        }
    }
예제 #6
0
    public void ApplyColorChange(ColorScriptableObject cso = null)
    {
        ColorScriptableObject colorObject = ScriptableColorObject;

        if (cso != null)
        {
            colorObject = cso;
        }

        //Update button Components
        Button b = GetComponent <Button>();

        if (b)
        {
            ColorBlock block = b.colors;
            block.normalColor      = colorObject.normalColor;
            block.highlightedColor = colorObject.highlightColor;
            block.pressedColor     = colorObject.pressedColor;
            block.disabledColor    = colorObject.disabledColor;
            block.colorMultiplier  = colorObject.colorMultiplier;
            b.colors = block;

            //ButtonSettings button0 = colorObject.ButtonPresets[0];
            //ColorBlock block = b.colors;
            //block.normalColor = button0.normalColor;
            //block.highlightedColor = button0.highlightColor;
            //block.pressedColor = button0.pressedColor;
            //block.disabledColor = button0.disabledColor;
            //block.colorMultiplier = button0.colorMultiplier;
            //b.colors = block;

            return;
        }

        //Update outline Components
        Outline o = GetComponent <Outline>();

        if (o)
        {
            Vector2 shadow = o.effectDistance;
            o.effectColor = colorObject.effectColor;
            shadow.x      = colorObject.effectDistanceX;
            shadow.y      = colorObject.effectDistanceY;
        }
        //Update image Components
        Image i = GetComponent <Image>();

        if (i)
        {
            i.sprite   = colorObject.sourceImage;
            i.color    = colorObject.imageColor;
            i.material = colorObject.imageMaterial;
        }
        //Update text Components
        Text t = GetComponent <Text>();

        if (t)
        {
            t.font  = colorObject.primaryFont;
            t.color = colorObject.textColor;
        }
    }