public Shop(Player ThePlayer) { player = ThePlayer; MenuInit(); }
/// <summary> /// Initial Spawn of Game Entities (Player, Enemies, Powerups, etc.) /// </summary> private void Spawn() { for (int y = 0; y < Map.Field.GetLength(1)-1; y++) { for (int x = 0; x < Map.Field.GetLength(0) - 1; x++) { //Spawnpoint Player if (Map.Field[x, y] == 'X') { Map.Field[x, y] = ' '; if (PlayerInstance == null) PlayerInstance = new Player(x, y); else PlayerInstance.Position = new Vector2(x, y); } //End of Level if (Map.Field[x, y] == 'O') { Map.Field[x, y] = ' '; EndOfLevel End = new EndOfLevel(x, y); End.Game = this; } //Spawn Enemies if (Map.Field[x, y] == 'E') { Map.Field[x, y] = ' '; Enemy enemy = new Enemy(x, y); enemy.Player = PlayerInstance; enemy.Map = Map; } } } //bool hasSpawned = false; //Random tempRnd = new Random(); //while (!hasSpawned) //{ // Vector2 Spawn = new Vector2(tempRnd.Next(Map.Field.GetLength(1)), Map.Field.GetLength(2)); // if (Map.Field[Spawn.X, Spawn.Y] == ' ') //} }
//FUNKTION DAS MAN MEHRERE SACHEN AUSWHÄLEN KANN??????? bzw erneut wählen kann private void MenuInit() { Player player = new Player(0, 0); Menu ShopMenu = new Menu(8); Action tempAction = new Action(BuyMP5); ShopMenu.SetButton(0, "MP5 - " + mp5value + "G", tempAction); tempAction = new Action(MP5Ammo); ShopMenu.SetButton(1, "MP5-Ammo + 10 - " + mp5ammovalue + "G", tempAction); tempAction = new Action(BuyAk47); ShopMenu.SetButton(2, "AK47 - " + ak47value + "G", tempAction); tempAction = new Action(AKAmmo); ShopMenu.SetButton(3, "AK47-Ammo + 10 - " + ak47ammovalue + "G", tempAction); tempAction = new Action(BuyRocketLauncher); ShopMenu.SetButton(4, "RocketLauncher - " + rlvalue + "G", tempAction); tempAction = new Action(RocketAmmo); ShopMenu.SetButton(5, "Rockets + 3 - " + rocketvalue + "G", tempAction); tempAction = new Action(BuyArmor); ShopMenu.SetButton(6, "Armor + 5 - " + armorvalue + "G", tempAction); tempAction = new Action(Exit); ShopMenu.SetButton(7, "Start next Level", tempAction); }