Esempio n. 1
0
    public void UpdateDisplays()
    {
        costDisplay.text        = formatter.FormatNumber(Cost);
        levelDisplay.text       = "Level " + (Level + freeLevels).ToString("N0");
        levelSourceDisplay.text = level.ToString("N0") + " levels from upgrading";
        if (freeLevels > 0)
        {
            levelSourceDisplay.text += "\n" + freeLevels.ToString("N0") + " free levels from dropping coins";
        }
        if (diamond.diamondMultiLevels > 0)
        {
            levelSourceDisplay.text += "\n" + diamond.diamondMultiLevels.ToString("N0") + " levels from diamond upgrade";
        }

        multiplierDisplay.text = CoinMulti.ToString("N2") + "x coins";
        if (upgradeHandler.IsUpgradePurchased(204))
        {
            multiplierDisplay.text += "\n" + formatter.FormatNumber(upgradeHandler.GetEffect(204)) + "x clickpoints";
        }
        if (upgradeHandler.IsUpgradePurchased(304))
        {
            multiplierDisplay.text += "\n" + formatter.FormatNumber(upgradeHandler.GetEffect(304)) + "x experience";
        }
        if (upgradeHandler.IsUpgradePurchased(31))
        {
            multiplierDisplay.text += "\n+" + (Level * 0.75f).ToString("N1") + "% extra coin chance";
        }
        if (upgradeHandler.IsUpgradePurchased(45))
        {
            multiplierDisplay.text += "\n" + DiamondCoinMulti.ToString("N3") + "x diamond coins";
        }
    }
Esempio n. 2
0
    void SpawnCoin()
    {
        Vector3    randomPosOffset = new Vector3(UnityEngine.Random.Range(-300f, 300f), 0);
        GameObject coinObject      = (GameObject)Instantiate(coinInstance, transform.position + randomPosOffset, Quaternion.identity, transform.parent);

        Button coinButton = coinObject.GetComponent <Button>();

        coinButton.onClick.AddListener(() => OnCoinClick(coinObject));

        Rigidbody2D rigidbody = coinObject.GetComponent <Rigidbody2D>();

        rigidbody.gravityScale *= Convert.ToSingle(upgradeHandler.GetEffect(35));

        if (platinum)
        {
            coinObject.GetComponent <Image>().sprite = platinumSprite;
            platinum = false;
        }
    }