/// <summary> /// /// </summary> /// <param name="dungeon"></param> /// <param name="maze"></param> /// <param name="coordinate"></param> public DungeonLocationForm(Dungeon dungeon, DungeonLocation location) { InitializeComponent(); DungeonControl.Dungeon = dungeon; DungeonControl.Target = location; DungeonControl.GlControlBox.Click += new EventHandler(DungeonControl_Click); DungeonControl.GlControlBox.DoubleClick += new EventHandler(GlControlBox_DoubleClick); DirectionBox.Items.AddRange(Enum.GetNames(typeof(CardinalPoint))); GroundPositionBox.Items.AddRange(Enum.GetNames(typeof(SquarePosition))); Init(); }
/// <summary> /// Constructor /// </summary> /// <param name="dungeon">Dungeon handle</param> public Maze(Dungeon dungeon) { Name = "No name"; Dungeon = dungeon; Squares = new List<List<Square>>(); ThrownItems = new List<ThrownItem>(); Zones = new List<MazeZone>(); DoorDeco = -1; CeilingPitDeco = -1; FloorPitDeco = -1; IsDisposed = false; }
/// <summary> /// Gets the square /// </summary> /// <param name="dungeon">Dungeon handle</param> /// <returns>Square handle or null</returns> public Square GetSquare(Dungeon dungeon) { if (dungeon == null) return null; Maze maze = dungeon.GetMaze(Maze); if (maze == null) return null; return maze.GetSquare(Coordinate); }
/// <summary> /// Gets the maze of the location /// </summary> /// <param name="dungeon">Dungeon handle</param> /// <returns>Maze handle or null</returns> public Maze GetMaze(Dungeon dungeon) { if (dungeon == null) return null; return dungeon.GetMaze(Maze); }
/// <summary> /// Teleport the team to a new location, but don't change direction /// </summary> /// <param name="location">Location in the dungeon</param> /// <returns>True if teleportion is ok, or false if M. Spoke failed !</returns> public bool Teleport(DungeonLocation location, Dungeon dungeon) { if (dungeon == null || location == null) return false; // Destination maze Maze maze = dungeon.GetMaze(location.Maze); if (maze == null) return false; Maze = maze; // Leave current square if (Square != null) Square.OnTeamLeave(); // Change location Location.Coordinate = location.Coordinate; Location.Maze = Maze.Name; Location.Direction = location.Direction; // New block Square = Maze.GetSquare(location.Coordinate); // Enter new block Square.OnTeamEnter(); return true; }
/// <summary> /// Loads a saved game /// </summary> /// <param name="slotid">Slot id to load</param> /// <returns>True on success</returns> public bool LoadGameSlot(int slotid) { SaveGameSlot slot = GameSettings.SavedGames.Slots[slotid]; if (slot == null) { Trace.WriteLine("[GameScreen]LoadGameSlot() : Slot " + slotid + " empty !"); return false; } // Load dungeon if (Dungeon != null) Dungeon.Dispose(); else Dungeon = new Dungeon(); // If Shift key is down, create a new dungeon (DEBUG) if (slot.Dungeon == null || Keyboard.IsKeyPress(Keys.ShiftKey)) Dungeon = ResourceManager.CreateAsset<Dungeon>(GameSettings.SavedGames.DungeonName); else Dungeon.Load(slot.Dungeon); Dungeon.Init(); // Load team if (Team != null) Team.Dispose(); else Team = new Team(); Team.Load(slot.Team); Team.Init(); GameMessage.AddMessage("Party loaded...", GameColors.Yellow); return true; }
/// <summary> /// Create a game with new team and new dungeon /// </summary> /// <param name="theteam">the team</param> /// <param name="thedungeon">the dungeon or null to start default one</param> public void NewGame(Team theteam, Dungeon thedungeon) { if (theteam == null) throw new ArgumentNullException("theteam"); // Load dungeon if (Dungeon != null) Dungeon.Dispose(); Dungeon = thedungeon ?? ResourceManager.CreateAsset<Dungeon>("EOB_2"); Dungeon.Init(); // Load team if (Team != null) Team.Dispose(); Team = theteam; Team.Init(); GameMessage.Clear(); GameMessage.AddMessage("New party starting...", GameColors.Yellow); }
/// <summary> /// /// </summary> /// <param name="dungeon"></param> /// <param name="maze"></param> /// <param name="coordinate"></param> public DungeonLocationForm(Dungeon dungeon, string maze, Point coordinate) : this (dungeon, new DungeonLocation(maze, coordinate)) { }