/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); Contents.LoadAll(Content, GraphicsDevice); #region InstantiateGraphicalContent // Fps fpsText = new Text("fps", 0, 0, "" + fps, () => { gameConsole.Log("Clicked me"); }); time = new Time(); timeText = new Text(time.ToString()); // (Content of this region is only meant for debugging purposes.) #region Test //Character adventurer = new Character("adventurer", isPlayerControlled: true, // keyboardInput: KeyboardInput.Default(), // animatedSprite: SpriteFactory.Adventurer(Vector2.Zero)); //Character swordsman = new Character("swordsman", isPlayerControlled: true, // keyboardInput: KeyboardInput.Alternative(), // animatedSprite: SpriteFactory.Swordsman(Vector2.Zero)); Random rnd = new Random(); Character[] chars = new Character[30]; for (int i = 0; i < chars.Length; i++) { if (i % 2 == 0) { chars[i] = new Character("Char" + i, isPlayerControlled: true, keyboardInput: KeyboardInput.Default(), animatedSprite: SpriteFactory.Swordsman(new Vector2(rnd.Next(0, 3240), rnd.Next(0, 2160)))); } else { chars[i] = new Character("Char" + i, isPlayerControlled: true, keyboardInput: KeyboardInput.Alternative(), animatedSprite: SpriteFactory.Swordsman(new Vector2(rnd.Next(0, 3240), rnd.Next(0, 2160)))); } } CollisionManager collisionManager = new CollisionManager(); foreach (Character c in chars) { collisionManager.Collidables.Add(c.AnimatedSprite); } List <IEntity> entities = new List <IEntity>(); entities.Add(collisionManager); foreach (Character c in chars) { entities.Add(c.AnimatedSprite); } finiteStateMachine = new FiniteStateMachine(new Dictionary <EState, State>() { { EState.EmptyState, new EmptyState(new List <EState>() { EState.MainMenuState }) }, { EState.MainMenuState, StateFactory.DefaultMainMenuState() }, { EState.TestLevelState, StateFactory.TestLevelState(entities.ToArray()) }, { EState.InventoryState, StateFactory.InventoryState(chars) } }); finiteStateMachine.Change(EState.MainMenuState); #endregion #endregion }