// 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);
        }
    }
Esempio n. 2
0
    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");
        }
    }
Esempio n. 3
0
    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));
    }
Esempio n. 4
0
 // 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;
     }
 }
Esempio n. 5
0
    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;
    }
Esempio n. 7
0
    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();
        }
    }
Esempio n. 8
0
    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);
    }
Esempio n. 9
0
 private void UpdateLabel()
 {
     amountLabel.SetText(BadAtMathQuirk.ApplyQuirkIfPresent(Game.instance.playerData.numCoins).ToString());
 }
Esempio n. 10
0
    public void GeneratePopup(Vector3 position, int amount, NumberPopupReason reason, float delay = 0f)
    {
        amount = BadAtMathQuirk.ApplyQuirkIfPresent(amount);

        StartCoroutine(mInstance.GeneratePopupEnumerator(position, amount.ToString(), reason, delay));
    }