/// <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> /// 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> /// 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> /// 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; }