C# Класс Gruppe22.Backend.Generator

Наследование: Map
Показать файл Открыть проект

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
_NextTile ( Path &pos ) : void
_Walk ( Path current ) : Path

Get the next tile based on included Connection info

Описание методов

AddBoss() публичный Метод

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
Результат void

AddCheckpoint() публичный Метод

Method to add the CheckpointTiles to a room.
public AddCheckpoint ( ) : void
Результат void

AddDoors() публичный Метод

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
Результат void

AddEnemies() публичный Метод

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
Результат void

AddItems() публичный Метод

Method to place some random items in a room.
public AddItems ( int amount = -1 ) : void
amount int 5 by default.
Результат void

AddNPC() публичный Метод

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
Результат void

AddPlayer() публичный Метод

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
Результат void

AddShop() публичный Метод

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
Результат void

AddStairs() публичный Метод

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
Результат void

AddTarget() публичный Метод

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
Результат void

AddTraps() публичный Метод

Method to add some TrapTiles to a room.
public AddTraps ( int amount = -1 ) : void
amount int 5 by default.
Результат void

CleanupRoom() публичный Метод

public CleanupRoom ( ) : void
Результат void

ClearMaze() публичный Метод

Create a grid of walls
public ClearMaze ( ) : void
Результат void

ClearTile() публичный Метод

Remove all elements from a tile
public ClearTile ( int x, int y ) : void
x int
y int
Результат void

ClearWalls() публичный Метод

Remove walls at random for more space
public ClearWalls ( int amount = -1 ) : void
amount int Amount of walls to remove
Результат void

ConnectTo() публичный Метод

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
Результат void

DrawWalls() публичный Метод

Method to add the outer walls to a room.
public DrawWalls ( ) : void
Результат void

FromString() публичный Метод

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
Результат bool

GenerateDungeon() публичный Метод

Method to choose a name for the dungeon.
public GenerateDungeon ( ) : void
Результат void

GenerateMaze() публичный Метод

Create a new maze
public GenerateMaze ( ) : void
Результат void

GenerateRoomName() публичный Метод

Method to choose a name for a room.
public GenerateRoomName ( ) : void
Результат void

Generator() публичный Метод

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
Результат System

Generator() публичный Метод

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
Результат System

HasExit() публичный Метод

Method to check whether there is a connection to another room.
public HasExit ( Direction dir ) : bool
dir Direction
Результат bool

Save() публичный Метод

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
Результат void

SuggestExit() публичный Метод

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
Результат Backend.Coords