// Update is called once per frame void Update() { Spell spell = Game.instance.avatar.GetComponentInChildren <Spell>(); bool canActivate = (spell != null && spell.canActivate && Game.instance.InDungeon()); if (spell != null) { icon.sprite = spell.icon; } inactiveBackground.SetActive(!canActivate); activeBackground.SetActive(canActivate); cooldownOverlay.gameObject.SetActive(!canActivate); cooldownSecondsLabel.gameObject.SetActive(!canActivate); int secondsRemaining = (spell == null ? 0 : Mathf.CeilToInt(spell.cooldownTimer)); if (mPreviousDisplaySeconds != secondsRemaining) { mPreviousDisplaySeconds = secondsRemaining; cooldownSecondsLabel.text = BadAtMathQuirk.ApplyQuirkIfPresent(secondsRemaining).ToString(); } if (spell == null || !Game.instance.InDungeon()) { cooldownOverlay.fillAmount = 1f; } else { cooldownOverlay.fillAmount = (spell.cooldownTimer / spell.cooldown); } }
public void ShowForItem(Item item) { if (item == mCurrentItem) { return; } mCurrentItem = item; gameObject.SetActive(true); title.text = PigLatinQuirk.ApplyQuirkIfPresent(LocalizedText.Get(item.friendlyName)); description.text = PigLatinQuirk.ApplyQuirkIfPresent(LocalizedText.Get(item.description)); cost.text = BadAtMathQuirk.ApplyQuirkIfPresent(item.Cost()).ToString(); image.sprite = item.GetComponentInChildren <SpriteRenderer>().sprite; transform.localScale = Vector3.zero; transform.DOKill(); transform.DOScale(1f, 0.3f); bool enoughMoney = Game.instance.playerData.numCoins >= item.Cost(); purchaseContainer.SetActive(enoughMoney); notEnoughMoneyContainer.SetActive(!enoughMoney); if (Game.instance.quirkRegistry.IsQuirkActive <PigLatinQuirk>()) { buy.text = PigLatinQuirk.ApplyQuirkIfPresent("BUY"); notEnoughMoney.text = PigLatinQuirk.ApplyQuirkIfPresent("Not Enough Money"); notEnoughMoneyShadow.text = PigLatinQuirk.ApplyQuirkIfPresent("Not Enough Money"); } }
public void GeneratePopup(GameObject entity, int amount, NumberPopupReason reason, float delay = 0f) { amount = BadAtMathQuirk.ApplyQuirkIfPresent(amount); Vector3 position = entity.transform.position + Vector3.up * 0.7f; StartCoroutine(mInstance.GeneratePopupEnumerator(position, amount.ToString(), reason, delay)); }
// Update is called once per frame void Update() { if (mPreviousDisplayValue != Game.instance.currentDungeonFloor) { mPreviousDisplayValue = Game.instance.currentDungeonFloor; string newDisplay = BadAtMathQuirk.ApplyQuirkIfPresent(mPreviousDisplayValue, 2).ToString(); label.text = newDisplay; labelShadow.text = newDisplay; } }
public void SetWithValues(int min, int max, int value) { float percent = (float)value / (float)(max - min); fullImage.fillAmount = percent; if (label != null) { label.text = "" + BadAtMathQuirk.ApplyQuirkIfPresent(value) + " / " + BadAtMathQuirk.ApplyQuirkIfPresent(max); } }
public void ShowDialog(string message, int cost, string effect, string successEvent, string failEvent) { gameObject.SetActive(true); mCost = cost; costLabel.text = BadAtMathQuirk.ApplyQuirkIfPresent(mCost).ToString(); messageLabel.text = PigLatinQuirk.ApplyQuirkIfPresent(message); mSuccessEvent = successEvent; mFailEvent = failEvent; mEffect = effect; }
private void Start() { // todo bdsowers - ew gameObject.AddComponent <RevealWhenAvatarIsClose>().allowScaleVariation = false; GameObject costCanvas = GameObject.Instantiate(PrefabManager.instance.PrefabByName("CostCanvas"), transform); Text[] labels = costCanvas.GetComponentsInChildren <Text>(); for (int i = 0; i < labels.Length; ++i) { labels[i].text = BadAtMathQuirk.ApplyQuirkIfPresent(Cost()).ToString(); } }
public void ShowDialog() { maxHealthCostLabel.text = BadAtMathQuirk.ApplyQuirkIfPresent(UpgradeCost(CharacterStatType.MaxHealth)).ToString(); strengthCostLabel.text = BadAtMathQuirk.ApplyQuirkIfPresent(UpgradeCost(CharacterStatType.Strength)).ToString(); defenseCostLabel.text = BadAtMathQuirk.ApplyQuirkIfPresent(UpgradeCost(CharacterStatType.Defense)).ToString(); magicCostLabel.text = BadAtMathQuirk.ApplyQuirkIfPresent(UpgradeCost(CharacterStatType.Magic)).ToString(); speedCostLabel.text = BadAtMathQuirk.ApplyQuirkIfPresent(UpgradeCost(CharacterStatType.Speed)).ToString(); luckCostLabel.text = BadAtMathQuirk.ApplyQuirkIfPresent(UpgradeCost(CharacterStatType.Luck)).ToString(); EnforceMaxSpeed(); gameObject.SetActive(true); }
private void UpdateLabel() { amountLabel.SetText(BadAtMathQuirk.ApplyQuirkIfPresent(Game.instance.playerData.numCoins).ToString()); }
public void GeneratePopup(Vector3 position, int amount, NumberPopupReason reason, float delay = 0f) { amount = BadAtMathQuirk.ApplyQuirkIfPresent(amount); StartCoroutine(mInstance.GeneratePopupEnumerator(position, amount.ToString(), reason, delay)); }