Exemple #1
0
    private void OnClick()
    {
        switch (Argument)
        {
        case "Tavern":
            if (tavern.level < 20)
            {
                if (gameplay.playerGold - tavern.levelUpCost >= 0)
                {
                    tavern.LevelUp();
                    gameplay.playerGold -= tavern.levelUpCost;
                }
                else
                {
                    Debug.Log("Not enough money to upgrade tavern");
                }
            }
            break;

        case "Minimize":
            tavern.Minimize();
            break;

        case "Ready":
            gameplay.StartWave();
            break;

        default:
            if (gameplay.numberOfHeroes < gameplay.maxHeroes && gameplay.playerGold - tavern.heroCost >= 0 && !tavern.heroSelected)
            {
                gameplay.playerGold -= tavern.heroCost;
                Hero h = Instantiate(Resources.Load("Heroes/" + Argument, typeof(Hero)) as Hero) as Hero;
                h.Birth(Argument);
                tavern.heroSelected = true;
            }
            else if (gameplay.numberOfHeroes >= gameplay.maxHeroes)
            {
                Debug.Log(gameplay.numberOfHeroes + "/" + gameplay.maxHeroes + " maximum Heroes");
            }
            else if (gameplay.playerGold - tavern.heroCost < 0)
            {
                Debug.Log(gameplay.playerGold + " - " + tavern.heroCost + " <= 0");
            }
            else if (selected)
            {
                Debug.Log("Currently placing");
            }
            break;
        }
    }