예제 #1
0
        public void NewLevel(int currentLevel, ContentManager content, Texture2D buttonTexture)
        {
            this.currentLevel = currentLevel;

            enemies = new List <Enemy>();

            if (playerTower == null)
            {
                playerTower = new Tower(content, new Vector2(0.0f, 280f), "playerTower");
            }

            enemyTower  = new Tower(content, new Vector2(730f, 280f), "enemyTower");
            corpses     = new List <Corpse>();
            playerQueue = new List <Queueable>();
            enemyQueue  = new List <Queueable>();
            queue       = new Queue(content);

            inputManager   = new BattleInputManager(buttonTexture, content);
            soldierManager = new SoldierManager();

            if (currentLevel < 1)
            {
                return;
            }

            StreamReader reader = new StreamReader(Environment.CurrentDirectory + "/Level Data/level" + currentLevel.ToString() + ".txt");

            string[] strArray = reader.ReadToEnd().Split('\n');
            for (int index = 0; index < strArray.Length; index += 2)
            {
                enemies.Add(new Enemy(Convert.ToInt32(strArray[index]), Convert.ToInt32(strArray[index + 1])));
            }

            if (hasTurretOne)
            {
                playerTurretOne = new Turret(content, playerTower.Rectangle, 3, "turretRightStraight");
            }
            if (hasTurretTwo)
            {
                playerTurretTwo = new Turret(playerTower.Rectangle, content, 1, "turretRightDown");
            }
            if (hasWizardTower)
            {
                wizardTower = new WizardTower(content, new Vector2(playerTower.Position.X, playerTower.Position.Y));
            }
            if (hasArcher)
            {
                aimableArcher = new AimableArcher(content);
            }
        }
예제 #2
0
 public void BuyArcher(ContentManager content)
 {
     hasArcher     = true;
     aimableArcher = new AimableArcher(content);
 }