public static GameObject CreatePlayer(PlayerIndex?index, BeatEmUpGame game) { GameObject player = game.CreateGameObjectFromName("Player"); // keyboard if (index == null) { player.AddComponent(new KeyboardInputController(player)); } else { player.AddComponent(new GamepadInputController(player, index.Value)); } player.InitializeComponents(); return(player); }
private List <GameObject> CreateMonsters(BeatEmUpGame game) { List <GameObject> monsters = new List <GameObject>(); float x = direction == WaveDirection.Left ? x = game.View.Position.X - 100f : game.View.Position.X + game.Window.ClientBounds.Width + 100f; for (int i = 0; i < monsterCount; i++) { GameObject monster = game.CreateGameObjectFromName(monsterName); float y = random.Next(game.Window.ClientBounds.Height / 2 + 200, (int)(game.Window.ClientBounds.Height - monster.Size.Y)); Vector2 position = new Vector2(x, y); monster.Position = position; monsters.Add(monster); } return(monsters); }