public void RestoreCurrentSlot() { if (this.equipped.Equals(BuyableEquipped.NOT_EQUIPPED)) { return; } string auxId = this.id; this.id = gameObject.name; this.state = BuyableState.NOT_BOUGHT; this.equipped = BuyableEquipped.NOT_EQUIPPED; GameManager.Instance.player.rocks.currentItems.Remove(auxId); PlayerPrefs.SetInt(auxId + "_Equipped", 0); PlayerPrefs.Save(); this.price = 0; this.chosedToEquipped = false; this.transform.GetChild(1).GetComponent <Image>().sprite = controller.noImage; this.transform.GetChild(1).GetComponent <Image>().color = new Color32(255, 255, 255, 128); foreach (BuyableItem item in controller.items) { item.CheckEquipped(auxId); } }
public void Equip() { equipped = BuyableEquipped.EQUIPPED; if (!GameManager.Instance.player.rocks.currentItems.Contains(id)) { GameManager.Instance.player.rocks.currentItems.Add(id); } PlayerPrefs.SetInt(id + "_Equipped", 1); }
public void Set(BuyableItem item) { this.id = item.id; this.price = item.price; this.image = item.image; this.state = item.state; this.equipped = item.equipped; this.chosedToEquipped = item.chosedToEquipped; this.controller = item.controller; this.transform.GetChild(1).GetComponent <Image>().sprite = this.image; this.transform.GetChild(1).GetComponent <Image>().color = new Color32(255, 255, 255, 255); this.Init(); }
private void Start() { if (PlayerPrefs.GetInt(id + "_Equipped") > 0 && transform.parent.gameObject.name != "CurrentBackground") { equipped = BuyableEquipped.EQUIPPED; controller.FillEquipped(this); if (!GameManager.Instance.player.rocks.currentItems.Contains(id)) { GameManager.Instance.player.rocks.currentItems.Add(id); } GetComponent <Button>().interactable = false; } }