void Start() { Object[] objects = Object.FindObjectsOfType(typeof(GameObject)); foreach (GameObject item in objects) { Jewellary jewellary = item.GetComponent <Jewellary>(); if (jewellary != null) { jewellary.score = GetScore(jewellary.ItemColor); } } }
public void AddItem(Jewellary jewellary) { if (jewellarys.ContainsKey(jewellary.ItemColor)) { Debug.LogWarning("Usage: jewellary " + jewellary.ItemColor + " exist"); } else { jewellarys.Add(jewellary.ItemColor, jewellary.score); UpdateItemGUI(jewellary); Destroy(jewellary.gameObject); // Destroy object } }
public void UpdateItems(Jewellary jewellary) { switch (jewellary.ItemColor) { case ItemColor.red: redJewellary.SetActive(true); break; case ItemColor.green: greenJewellary.SetActive(true); break; case ItemColor.blue: blueJewellary.SetActive(true); break; default: break; } }
private void UpdateItemGUI(Jewellary jewellary) { // Debug.Log("Get"); itemGUI.UpdateItems(jewellary); }