Example #1
0
        /**
         * Adds toggle to group
         */
        public void RegisterToggle(GemToggle toggle)
        {
            //following line used for testing
            //gm.LockAllGems ();


            // Will set  up gem system if hasnt been used before
            gm.CheckFirstGame();

            //will unlock the default gems
            gm.UnlockGem(GemOneDefault);
            gm.UnlockGem(GemTwoDefault);

            if (PlayerPrefs.GetInt("SpiderLevelScene") > 0)
            {
                gm.UnlockGem(Gem.Blue);
            }

            if (PlayerPrefs.GetInt("HeightsLevelScene") > 0)
            {
                gm.UnlockGem(Gem.Turquoise);
            }

            if (PlayerPrefs.GetInt("DarknessLevelScene") > 0)
            {
                gm.UnlockGem(Gem.Yellow);
            }

            if (PlayerPrefs.GetInt("SpiderLevelScene") > 500 &&
                PlayerPrefs.GetInt("HeightsLevelScene") > 500 &&
                PlayerPrefs.GetInt("DarknessLevelScene") > 500)
            {
                gm.UnlockGem(Gem.Purple);
            }


            //will register the default selection to gem manager
            gm.SetDefaultSelection(GemOneDefault, GemTwoDefault);

            Debug.Log(gm.GetDefaultGemOne().ToString() + "  default gem 1");
            Debug.Log(gm.GetDefaultGemTwo().ToString() + "  default gem 2");

            toggle.isOn            = false;
            toggle.LastGemSelected = false;

            //Will set gem toggle state for default gems
            if (toggle.AssociatedGem == gm.GetDefaultGemOne())
            {
                toggle.isOn            = true;
                toggle.LastGemSelected = false;
            }
            else if (toggle.AssociatedGem == gm.GetDefaultGemTwo())
            {
                toggle.isOn            = true;
                toggle.LastGemSelected = true;
            }

            if (!m_Toggles.Contains(toggle))
            {
                m_Toggles.Add(toggle);
            }
        }