Example #1
0
        public void AddTower()
        {
            Tower towerToAdd = null;

            switch (newTowerType)
            {
            case "Arrow Tower":
            {
                towerToAdd = new ArrowTower(towerTextures[0], bulletTexture, new Vector2(tileX, tileY), content);
                break;
            }

            case "Spike Tower":
            {
                towerToAdd = new SpikeTower(towerTextures[1], bulletTexture, new Vector2(tileX, tileY), content);
                break;
            }
            }
            if (IsCellClear() == true && towerToAdd.Cost <= money)
            {
                towers.Add(towerToAdd);
                money       -= towerToAdd.Cost;
                newTowerType = string.Empty;
            }
        }
Example #2
0
        public void AddTower()
        {
            Tower towerToAdd = null;

            switch (newTowerType)
            {
                case "Arrow Tower":
                    {
                        towerToAdd = new ArrowTower(towerTextures[0],bulletTexture, new Vector2(tileX, tileY),content);
                        break;
                    }

                case "Spike Tower":
                    {
                        towerToAdd = new SpikeTower(towerTextures[1], bulletTexture, new Vector2(tileX, tileY),content);
                        break;
                    }
            }
            if (IsCellClear() == true && towerToAdd.Cost <= money)
            {
                towers.Add(towerToAdd);
                money -= towerToAdd.Cost;
                newTowerType = string.Empty;
            }
        }