/** * Will run everytime toggle in group is clicked. */ public void NotifyToggleClick(GemToggle toggle) { if (ActiveToggles().Count() == 1) { for (var i = 0; i < m_Toggles.Count; i++) { if (m_Toggles [i].isOn) { gm.SetGemOne(m_Toggles [i].AssociatedGem); gm.SetGemTwo(m_Toggles [i].AssociatedGem); } } } if (!toggle.isOn) { if (gm.GetGemOne() == toggle.AssociatedGem) { gm.ClearGemOne(); } else if (gm.GetGemTwo() == toggle.AssociatedGem) { gm.ClearGemTwo(); } } Debug.Log("***********************"); Debug.Log(gm.GetGemOne().ToString()); Debug.Log(gm.GetGemTwo().ToString()); }
// Called when script is loaded void Awake() { // Checks to make sure gems are persisted Debug.Log(gemManager.GetGemOne().ToString() + " successfully persisted"); Debug.Log(gemManager.GetGemTwo().ToString() + " successfully persisted"); spawn = GameObject.FindGameObjectWithTag("SpecialAttack"); foreach (Transform childTransform in gameObject.transform.Find("Shot Spawn")) { if (childTransform.gameObject.CompareTag(gemManager.GetGemOne().ToString())) { gemOne = childTransform.gameObject; } if (childTransform.gameObject.CompareTag(gemManager.GetGemTwo().ToString())) { gemTwo = childTransform.gameObject; } } // Sets all gem game objects to be inactive except selected gems foreach (Transform child in spawn.transform) { child.gameObject.SetActive(false); } gemOne.SetActive(true); gemTwo.SetActive(true); gemTwo.GetComponent <GenericGem>().isCurrent = false; // Current selection starts with gemOne gemManager.SetCurrentGem(gemManager.GetGemOne()); // Updates which gem's abilities the staff is using updateStaff(gemOne); }
void Awake() { if (fire) { GemSelection.SetGemOne(Gem.Red); GemSelection.SetGemTwo(Gem.Green); } else if (lightning) { GemSelection.SetGemOne(Gem.Yellow); GemSelection.SetGemTwo(Gem.Green); } else if (ice) { GemSelection.SetGemOne(Gem.Blue); GemSelection.SetGemTwo(Gem.Green); } spawn = GameObject.FindGameObjectWithTag("SpecialAttack"); gemOne = GameObject.FindGameObjectWithTag(GemSelection.GetGemOne().ToString()); foreach (Transform child in spawn.transform) { child.gameObject.SetActive(false); } gemOne.SetActive(true); //current selection starts with gemOne GemSelection.SetCurrentGem(GemSelection.GetGemOne()); }