C# Class Gruppe22.Backend.Generator

Inheritance: Map
显示文件 Open project: propra13-orga/gruppe22

Public Methods

Method Description
AddBoss ( ) : void

Method to add a boss enemy to a room. A boss is more powerful than a normal enemy and the room gets a special sound if there is a boss in it.

AddCheckpoint ( ) : void

Method to add the CheckpointTiles to a room.

AddDoors ( int roomID = 1, int maxRoom = 3, List doors = null ) : void

Method to add a door to the next level to a room.

AddEnemies ( int amount = -1 ) : void

Method to generate the enemys for a room. The method places enemys at free position and initializes them.

AddItems ( int amount = -1 ) : void

Method to place some random items in a room.

AddNPC ( int amount = -1 ) : void

Method to add NPCs in a room. By default the NPCs have some money and a dialogue.

AddPlayer ( Coords pos ) : void

Method to add the player to a room.

AddShop ( ) : void

Method to add a shop to the map. The method adds a NPC with a shop and some custom tiles around him.

AddStairs ( Coords srcCoords, int targetRoom, Backend targetCoords, bool up ) : void

Method to add the stairs to the next level to a room.

AddTarget ( Coords srcCoords ) : void

Method to add the TargetTile to a room (usually a room in the highest level). The Target is surrounded by walls and a door.

AddTraps ( int amount = -1 ) : void

Method to add some TrapTiles to a room.

CleanupRoom ( ) : void
ClearMaze ( ) : void

Create a grid of walls

ClearTile ( int x, int y ) : void

Remove all elements from a tile

ClearWalls ( int amount = -1 ) : void

Remove walls at random for more space

ConnectTo ( Coords from, int Room, Backend to, bool isTeleport = false ) : void

Add a doorway / stairway / teleporter to another room

DrawWalls ( ) : void

Method to add the outer walls to a room.

FromString ( string input, int roomID, int MaxRoom ) : bool

Method to generate a room from a string (e.g. a .txt)

GenerateDungeon ( ) : void

Method to choose a name for the dungeon.

GenerateMaze ( ) : void

Create a new maze

GenerateRoomName ( ) : void

Method to choose a name for a room.

Generator ( object parent = null, int width = 10, int height = 10, bool generate = false, Backend playerPos = null, int roomNr = 1, int maxRoom = 3, Random rnd = null, string dungeonname = "", int level, bool hasShop = false, bool hasNPC = false, bool hasBoss = false ) : System

Create an empty map

Generator ( object parent, string pattern, int roomNr = 1, int maxRoom = 3, List exits = null, Random rnd = null ) : System

The constructor for the Generator.

HasExit ( Direction dir ) : bool

Method to check whether there is a connection to another room.

Save ( string filename, string subdir = "save\\auto\\" ) : void

Write the current map to a file

SuggestExit ( Direction dir ) : Backend.Coords

Find an appropriate place to put an exit on the map

Private Methods

Method Description
_NextTile ( Path &pos ) : void
_Walk ( Path current ) : Path

Get the next tile based on included Connection info

Method Details

AddBoss() public method

Method to add a boss enemy to a room. A boss is more powerful than a normal enemy and the room gets a special sound if there is a boss in it.
public AddBoss ( ) : void
return void

AddCheckpoint() public method

Method to add the CheckpointTiles to a room.
public AddCheckpoint ( ) : void
return void

AddDoors() public method

Method to add a door to the next level to a room.
public AddDoors ( int roomID = 1, int maxRoom = 3, List doors = null ) : void
roomID int
maxRoom int
doors List
return void

AddEnemies() public method

Method to generate the enemys for a room. The method places enemys at free position and initializes them.
public AddEnemies ( int amount = -1 ) : void
amount int The number of enemys for a room, 5 by default
return void

AddItems() public method

Method to place some random items in a room.
public AddItems ( int amount = -1 ) : void
amount int 5 by default.
return void

AddNPC() public method

Method to add NPCs in a room. By default the NPCs have some money and a dialogue.
public AddNPC ( int amount = -1 ) : void
amount int 1 by default
return void

AddPlayer() public method

Method to add the player to a room.
public AddPlayer ( Coords pos ) : void
pos Coords The position at which the player will spawn, (1,1) by default
return void

AddShop() public method

Method to add a shop to the map. The method adds a NPC with a shop and some custom tiles around him.
public AddShop ( ) : void
return void

AddStairs() public method

Method to add the stairs to the next level to a room.
public AddStairs ( Coords srcCoords, int targetRoom, Backend targetCoords, bool up ) : void
srcCoords Coords The place where the stairs will get placed
targetRoom int The number of the room the stairs lead to
targetCoords Backend The coords of the stairs in the next room
up bool Upstairs or Downstairs
return void

AddTarget() public method

Method to add the TargetTile to a room (usually a room in the highest level). The Target is surrounded by walls and a door.
public AddTarget ( Coords srcCoords ) : void
srcCoords Coords The coordinates for the TargetTile
return void

AddTraps() public method

Method to add some TrapTiles to a room.
public AddTraps ( int amount = -1 ) : void
amount int 5 by default.
return void

CleanupRoom() public method

public CleanupRoom ( ) : void
return void

ClearMaze() public method

Create a grid of walls
public ClearMaze ( ) : void
return void

ClearTile() public method

Remove all elements from a tile
public ClearTile ( int x, int y ) : void
x int
y int
return void

ClearWalls() public method

Remove walls at random for more space
public ClearWalls ( int amount = -1 ) : void
amount int Amount of walls to remove
return void

ConnectTo() public method

Add a doorway / stairway / teleporter to another room
public ConnectTo ( Coords from, int Room, Backend to, bool isTeleport = false ) : void
from Coords Coordinates in this room
Room int Uinque ID of target room
to Backend Coordinates in target room
isTeleport bool
return void

DrawWalls() public method

Method to add the outer walls to a room.
public DrawWalls ( ) : void
return void

FromString() public method

Method to generate a room from a string (e.g. a .txt)
public FromString ( string input, int roomID, int MaxRoom ) : bool
input string The string from which the room will be constructed
roomID int The number of the room.
MaxRoom int The max number of rooms
return bool

GenerateDungeon() public method

Method to choose a name for the dungeon.
public GenerateDungeon ( ) : void
return void

GenerateMaze() public method

Create a new maze
public GenerateMaze ( ) : void
return void

GenerateRoomName() public method

Method to choose a name for a room.
public GenerateRoomName ( ) : void
return void

Generator() public method

Create an empty map
public Generator ( object parent = null, int width = 10, int height = 10, bool generate = false, Backend playerPos = null, int roomNr = 1, int maxRoom = 3, Random rnd = null, string dungeonname = "", int level, bool hasShop = false, bool hasNPC = false, bool hasBoss = false ) : System
parent object
width int The width of the map
height int The height of the map
generate bool
playerPos Backend
roomNr int
maxRoom int
rnd System.Random
dungeonname string
level int
hasShop bool
hasNPC bool
hasBoss bool
return System

Generator() public method

The constructor for the Generator.
public Generator ( object parent, string pattern, int roomNr = 1, int maxRoom = 3, List exits = null, Random rnd = null ) : System
parent object
pattern string
roomNr int
maxRoom int
exits List
rnd System.Random
return System

HasExit() public method

Method to check whether there is a connection to another room.
public HasExit ( Direction dir ) : bool
dir Direction
return bool

Save() public method

Write the current map to a file
public Save ( string filename, string subdir = "save\\auto\\" ) : void
filename string The filename to write to
subdir string
return void

SuggestExit() public method

Find an appropriate place to put an exit on the map
public SuggestExit ( Direction dir ) : Backend.Coords
dir Direction Wall on which exit should be placed
return Backend.Coords