C# Class Gruppe22.Backend.Generator

Inheritance: Map
Afficher le fichier Open project: propra13-orga/gruppe22

Méthodes publiques

Méthode 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

Méthode Description
_NextTile ( Path &pos ) : void
_Walk ( Path current ) : Path

Get the next tile based on included Connection info

Method Details

AddBoss() public méthode

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
Résultat void

AddCheckpoint() public méthode

Method to add the CheckpointTiles to a room.
public AddCheckpoint ( ) : void
Résultat void

AddDoors() public méthode

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
Résultat void

AddEnemies() public méthode

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
Résultat void

AddItems() public méthode

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

AddNPC() public méthode

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
Résultat void

AddPlayer() public méthode

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
Résultat void

AddShop() public méthode

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
Résultat void

AddStairs() public méthode

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
Résultat void

AddTarget() public méthode

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
Résultat void

AddTraps() public méthode

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

CleanupRoom() public méthode

public CleanupRoom ( ) : void
Résultat void

ClearMaze() public méthode

Create a grid of walls
public ClearMaze ( ) : void
Résultat void

ClearTile() public méthode

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

ClearWalls() public méthode

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

ConnectTo() public méthode

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
Résultat void

DrawWalls() public méthode

Method to add the outer walls to a room.
public DrawWalls ( ) : void
Résultat void

FromString() public méthode

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
Résultat bool

GenerateDungeon() public méthode

Method to choose a name for the dungeon.
public GenerateDungeon ( ) : void
Résultat void

GenerateMaze() public méthode

Create a new maze
public GenerateMaze ( ) : void
Résultat void

GenerateRoomName() public méthode

Method to choose a name for a room.
public GenerateRoomName ( ) : void
Résultat void

Generator() public méthode

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
Résultat System

Generator() public méthode

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
Résultat System

HasExit() public méthode

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

Save() public méthode

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
Résultat void

SuggestExit() public méthode

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
Résultat Backend.Coords