Beispiel #1
0
        public MainMenu(GameStateStack gamestates, ContentManager Content)
        {
            states       = gamestates;
            this.Content = Content;

            List <String> levels = Content.Load <List <String> >("Levels/Levels");

            levelProtos = new List <SharedContent.LevelModel>();
            foreach (String name in levels)
            {
                levelProtos.Add(Content.Load <SharedContent.LevelModel>("Levels/" + name));
            }
            selectedLevel = 0;

            controllers = new List <PlayerIndex>();
            if (GamePad.GetState(PlayerIndex.One).IsConnected)
            {
                controllers.Add(PlayerIndex.One);
            }
            if (GamePad.GetState(PlayerIndex.Two).IsConnected)
            {
                controllers.Add(PlayerIndex.Two);
            }
            if (GamePad.GetState(PlayerIndex.Three).IsConnected)
            {
                controllers.Add(PlayerIndex.Three);
            }
            if (GamePad.GetState(PlayerIndex.Four).IsConnected)
            {
                controllers.Add(PlayerIndex.Four);
            }
            players = new List <Entity>();
        }
Beispiel #2
0
 /// <summary>
 /// Initialize a GameState to a level as defined by the level model.
 /// </summary>
 /// <param name="stack"></param>
 /// <param name="level"></param>
 public GameState(GameStateStack stack, SharedContent.LevelModel level)
     : this(stack)
 {
     foreach (SharedContent.CreepSpawner spawner in level.SpawnPoints)
         nonInteractives.Add(new Entity(spawner, Resources.res.content));
     gameObjectives.Add(Resources.getPrototype(level.GameObjectiveAsset));
     leveltime = leveltimeleft = level.Duration;
 }
Beispiel #3
0
 /// <summary>
 /// Create a GameState without initializing a level in it.
 /// </summary>
 /// <param name="stack">The GameStateStack to which this GameState belongs</param>
 public GameState(GameStateStack stack)
     : this()
 {
     this.stack              = stack;
     this.bgRenderable       = new Sprite(Resources.getRes("starfield"));
     this.bgRenderable.Tiled = true;
     this.view = new Viewport(Vector2.Zero, 500 * (Vector2.One + 0.667f * Vector2.UnitX));
 }
Beispiel #4
0
 /// <summary>
 /// Create a GameState without initializing a level in it.
 /// </summary>
 /// <param name="stack">The GameStateStack to which this GameState belongs</param>
 public GameState(GameStateStack stack)
     : this()
 {
     this.stack = stack;
     this.bgRenderable = new Sprite(Resources.getRes("starfield"));
     this.bgRenderable.Tiled = true;
     this.view = new Viewport(Vector2.Zero, 500 * (Vector2.One + 0.667f * Vector2.UnitX));
 }
Beispiel #5
0
 /// <summary>
 /// Initialize a GameState to a level as defined by the level model.
 /// </summary>
 /// <param name="stack"></param>
 /// <param name="level"></param>
 public GameState(GameStateStack stack, SharedContent.LevelModel level)
     : this(stack)
 {
     foreach (SharedContent.CreepSpawner spawner in level.SpawnPoints)
     {
         nonInteractives.Add(new Entity(spawner, Resources.res.content));
     }
     gameObjectives.Add(Resources.getPrototype(level.GameObjectiveAsset));
     leveltime = leveltimeleft = level.Duration;
 }
Beispiel #6
0
        public static GameState Create(GameStateStack stack, SharedContent.LevelModel level, List <Entity> players)
        {
            GameState ret = new GameState(stack, level);

            foreach (Entity player in players)
            {
                ret.addPlayer(player);
            }
            return(ret);
        }
Beispiel #7
0
        public MainMenu(GameStateStack gamestates, ContentManager Content)
        {
            states = gamestates;
            this.Content = Content;

            List<String> levels = Content.Load<List<String>>("Levels/Levels");
            levelProtos = new List<SharedContent.LevelModel>();
            foreach (String name in levels)
                levelProtos.Add(Content.Load<SharedContent.LevelModel>("Levels/" + name));
            selectedLevel = 0;

            controllers = new List<PlayerIndex>();
            if (GamePad.GetState(PlayerIndex.One).IsConnected) controllers.Add(PlayerIndex.One);
            if (GamePad.GetState(PlayerIndex.Two).IsConnected) controllers.Add(PlayerIndex.Two);
            if (GamePad.GetState(PlayerIndex.Three).IsConnected) controllers.Add(PlayerIndex.Three);
            if (GamePad.GetState(PlayerIndex.Four).IsConnected) controllers.Add(PlayerIndex.Four);
            players = new List<Entity>();
        }
Beispiel #8
0
 public static GameState Create(GameStateStack stack, SharedContent.LevelModel level, List<Entity> players)
 {
     GameState ret = new GameState(stack, level);
     foreach (Entity player in players)
         ret.addPlayer(player);
     return ret;
 }
Beispiel #9
0
 public PauseMenu(GameStateStack owner, PlayerIndex initiated)
 {
     this.owner = owner;
     this.initiated = initiated;
 }
Beispiel #10
0
 public PauseMenu(GameStateStack owner, PlayerIndex initiated)
 {
     this.owner     = owner;
     this.initiated = initiated;
 }