private void SetupPrice() { var price = Skill.GetPrice().FirstOrDefault(); if (price != null) { this.priceIcon.sprite = Resources.Load <Sprite>(price.Icon); UpdatePrice(); } else { this.priceText.gameObject.SetActive(false); this.priceIcon.gameObject.SetActive(false); } }
private void UpdatePrice() { if (IsUnlocked) { return; } var price = Skill.GetPrice().FirstOrDefault(); if (price == null) { return; } this.priceText.text = price.Amount.ToString(); }
public void Initialize(Skill skill) { Skill = skill; this.icon.sprite = Resources.Load <Sprite>(skill.Icon); this.nameText.text = skill.Name; var price = skill.GetPrice().FirstOrDefault(); if (price != null) { this.priceText.text = price.Amount.ToString(); this.priceIcon.sprite = Resources.Load <Sprite>(price.Icon); } else { this.priceContainer.gameObject.SetActive(false); } Deselect(); }
private void OnSkillBuyed(Skill skill) { if (this.spellbook.Skills.Any(unlocked => unlocked.Id == skill.Id)) { return; } try { this.currencies.Withdraw(skill.GetPrice()); } catch (GameplayException exception) { UiErrorFrame.Instance.Push(exception.Message); return; } this.spellbook.Add(skill); UpdateSkillPriceMultipliers(); View.UnlockSkill(skill); }