/// <summary> /// Loads the level specified with the specified level number. /// </summary> /// <param name="levelNumber">The level number of the level to load.</param> public void LoadLevel(int levelNumber) { GameState = GameState.Loading; if (Level != null) { /* Detach the level completed event. */ Level.LevelCompleted -= new EventHandler(Level_LevelCompleted); } Level = new Level(this, levelNumber); Level.LevelCompleted += new EventHandler(Level_LevelCompleted); string levelMap; // ThreadPool.QueueUserWorkItem( // delegate // { if (sokobanService != null) { levelMap = sokobanService.GetMap(levelNumber); using (StringReader reader = new StringReader(levelMap)) { Level.Load(reader); } } else { string fileName = string.Format(@"{0}Level{1:000}.skbn", levelDirectory, levelNumber); using (StreamReader reader = File.OpenText(fileName)) { Level.Load(reader); } } OnPropertyChanged("Level"); //context.Send(delegate //{ StartLevel(); //}, null); // }); }
/// <summary> /// Initializes a new instance of the <see cref="SearchPathFinder"/> class. /// </summary> /// <param name="start">The start cell. Presumably where /// the <see cref="Actor"/> is located.</param> /// <param name="destination">Where we would like to get.</param> public SearchPathFinder(Cell start, Location destination) { this.destination = destination; startCell = start; level = start.Level; }
/// <summary> /// Initializes a new instance of the <see cref="GoalCell"/> class. /// </summary> /// <param name="location">The location of the goal /// on the level grid.</param> /// <param name="level">The level grid where this cell /// is located.</param> public GoalCell(Location location, Level level) : base(cellName, location, level) { }
/// <summary> /// Initializes a new instance of the <see cref="GoalCell"/> class. /// </summary> /// <param name="location">The location of the goal /// on the level grid.</param> /// <param name="level">The level grid where this cell /// is located.</param> /// <param name="contents">The contents of this goal cell.</param> public GoalCell(Location location, Level level, CellContents contents) : base(cellName, location, level, contents) { }
/// <summary> /// Initializes a new instance of the <see cref="Actor"/> class. /// </summary> /// <param name="location">The location.</param> /// <param name="level">The level.</param> public Actor(Location location, Level level) : base("Actor", location, level) { }