Exemple #1
0
        public static void SetSkin(Skin newSkin)
        {
            Debug.Log("setskin");
            if (IsUnlocked(newSkin) && theme.horizonSkin != newSkin)
            {
                GameObject go = null;

                foreach (Theme t in _instance.themes)
                {
                    if (t.horizonSkin == newSkin)
                    {
                        ProgressManager.GetProgress().unlocks.currentSkin = newSkin;
                        skin = newSkin;

                        //Destroy(theme.gameObject);
                        theme = new Theme();

                        foreach (Transform child in _instance.transform)
                        {
                            Destroy(child.gameObject);
                        }
                        go = Instantiate(_instance.themePrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
                        go.gameObject.transform.parent        = _instance.transform;
                        go.gameObject.transform.localPosition = Vector3.zero;

                        // set theme element to fitting theme
                        Theme compTheme = go.GetComponent <Theme>();
                        compTheme = t;

                        // set all quad materials to fitting color
                        MeshRenderer[] mrs = go.GetComponentsInChildren <MeshRenderer>();
                        foreach (MeshRenderer mr in mrs)
                        {
                            WaveSetter wave = mr.GetComponent <WaveSetter>();
                            int        id   = wave.id;
                            switch (id)
                            {
                            case 1:
                                mr.material.color = t.horizonColor1;
                                break;

                            case 2:
                                mr.material.color = t.horizonColor2;
                                break;

                            case 3:
                                mr.material.color = t.horizonColor3;
                                break;

                            case 4:
                                mr.material.color = t.horizonColor4;
                                break;

                            case 5:
                                mr.material.color = t.horizonColor5;
                                break;
                            }
                        }
                        theme = t;

                        CamColorSetter.BgColorUpdate();

                        Debug.Log("Skin " + skin + " was set");
                        ProgressManager.SaveProgressData();
                        break;
                    }
                }
            }
            else
            {
                Debug.Log("Skin is not unlocked");
            }
        }
Exemple #2
0
 // Use this for initialization
 private void Start()
 {
     _instance = this;
     BgColorUpdate();
 }