Beispiel #1
0
    public void ShuffleNewShopingOptions(bool isFreeShuffle) // shuffle new shopping options
    {
        if (isFreeShuffle || (costToShuffleShop <= playerGoldCount && npcController.allyList.Count != 0))
        {
            for (int i = 0; i < 6; i++)
            {
                shoppingOptions[i] = (Unit)Enum.GetValues(typeof(Unit)).GetValue((int)UnityEngine.Random.Range(0, Enum.GetValues(typeof(Unit)).Length));

                while (shoppingOptions[i] == Unit.Eyebat || shoppingOptions[i] == Unit.AlienSoldier || shoppingOptions[i] == Unit.Engineer || shoppingOptions[i] == Unit.RobotCreep)
                {
                    shoppingOptions[i] = (Unit)Enum.GetValues(typeof(Unit)).GetValue((int)UnityEngine.Random.Range(0, Enum.GetValues(typeof(Unit)).Length));
                }
            }

            if (!isFreeShuffle)
            {
                sessionLogger.goldRewarded -= costToShuffleShop;
                SetPlayerGoldCount(playerGoldCount - costToShuffleShop);
                costToShuffleShop = (int)(3 * Mathf.Pow((1 + 0.25f), timesRefreshed++));
            }

            uiController.shopToggleButton.gameObject.SetActive(true);
            uiController.UpdateAllShopButtons();
            uiController.ChangeCostToShuffleShopDisplayText(costToShuffleShop.ToString());
            uiController.ChangeCostToUnitCapUpgradeDisplayText(costToUpgradeUnitCap.ToString());
            uiController.hudCanvasAudioSource.PlayOneShot(uiController.shopRefreshAudioClip);
        }
        else
        {
            uiController.hudCanvasAudioSource.PlayOneShot(uiController.genericButtonFailureAudioClip);
        }
    }