C#Code
C#Code
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Private Member Functions | Static Private Attributes
TheForum.GameCode.PieceGenerator Class Reference

List of all members.

Public Member Functions

 PieceGenerator ()
void Initialize (Libraries.AssetManager assetM)
bool AddDeff (PieceDefinition deff)
BasePiece GenerateType (StringType type, AssetManager assetM)
Libraries._3D.BaseModel GenerateModelType (StringType type, AssetManager assetM)
BasePiece GenerateTypeColor (StringType type, StringType color, AssetManager assetM)
BasePiece GenerateNonPiece (string tex, StringType shaderID, AssetManager assetM)
VertexPositionNormalTexture[] GetPieceVertexData ()
BasePiece GenerateType (string type, AssetManager assetM)
BasePiece GenerateType (string type, string color, AssetManager assetM)
void AddToAvailableTypes (StringType type)
Vector3 GetPieceCenterOffset ()
StringType PickRandomPieceType ()
void SetPieceRandomNumbers (int seed)
void ChangeColorType (BasePiece piece, StringType typeToChangeTo, Libraries.AssetManager assetM)
PieceDefinition GetDeff (StringType deffFind)
 PieceGenerator ()
void Initialize (Libraries.AssetManager assetM)
bool AddDeff (PieceDefinition deff)
BasePiece GenerateType (StringType type, AssetManager assetM)
BasePiece GenerateTypeColor (StringType type, StringType color, AssetManager assetM)
VertexPositionNormalTexture[] GetPieceVertexData ()
BasePiece GenerateType (string type, AssetManager assetM)
BasePiece GenerateType (string type, string color, AssetManager assetM)
void AddToAvailableTypes (StringType type)
Vector3 GetPieceCenterOffset ()
StringType PickRandomPieceType ()
void SetPieceRandomNumbers (int seed)
void ChangeColorType (BasePiece piece, StringType typeToChangeTo, Libraries.AssetManager assetM)
bool GetIs3DMode ()
void SetIs3DMode (bool use3DMode)

Protected Member Functions

int CheckForAvailablePieceType (StringType type)
int CheckForAvailablePieceType (StringType type)

Protected Attributes

List< PieceDefinitionm_deffinitions
 Stores all the deffinitions in the object.
Vector3 m_pieceDimensions
 Size of the pieces.
List< Libraries.StringTypem_availablePieceTypes
Random m_pieceRandomGenerator
 The random number generator that is used when picking the random pieces. This way it is seperate from other random stuff and I can keep things the same across multiple instances.
Libraries._3D.ModelVertexData.ExtractModelData.ModelDataPosNormTex m_pieceExtraction
 Store the extracted model data to use when creating a piece.
bool m_is3DMode
 True if it is creating 3D pieces, false if not.

Properties

static PieceGenerator Instance [get]
Vector3 PieceDimensions [get, set]

Private Member Functions

PieceDefinition GetDeff (StringType deffFind)

Static Private Attributes

static PieceGenerator m_instance
 Singleton instance.

Detailed Description

Used to create game pieces. Stores definitions for the pieces and generates the corresponding piece when requested. It can be used as a singleton.


Constructor & Destructor Documentation

TheForum.GameCode.PieceGenerator.PieceGenerator ( )

Default constructor.

TheForum.GameCode.PieceGenerator.PieceGenerator ( )

Default constructor.


Member Function Documentation

bool TheForum.GameCode.PieceGenerator.AddDeff ( PieceDefinition  deff)

Add the given piece deffinition. If a deffinition with the same type already exists, it is not added.

deff - Deffinition to add.

Return:
Value is true if the deffinition could be added, false if not.
bool TheForum.GameCode.PieceGenerator.AddDeff ( PieceDefinition  deff)

Add the given piece deffinition. If a deffinition with the same type already exists, it is not added.

deff - Deffinition to add.

Return:
Value is true if the deffinition could be added, false if not.
void TheForum.GameCode.PieceGenerator.AddToAvailableTypes ( StringType  type)

Add a type to the list of pieces that can be randomly selected to spawn.

type - Piece type that can be spawned. This could be a color, item, etc.
void TheForum.GameCode.PieceGenerator.AddToAvailableTypes ( StringType  type)

Add a type to the list of pieces that can be randomly selected to spawn.

type - Piece type that can be spawned. This could be a color, item, etc.
void TheForum.GameCode.PieceGenerator.ChangeColorType ( BasePiece  piece,
StringType  typeToChangeTo,
Libraries.AssetManager  assetM 
)

Change the color type of the given piece to be the type passed. If the piece isn't listed in the allowed color types, this won't do anything. The texture will be changed as well.

piece - Piece to change.
typeToChangeTo - Piece type to change the piece to.
assetM - Asset manager to get piece assets from.
void TheForum.GameCode.PieceGenerator.ChangeColorType ( BasePiece  piece,
StringType  typeToChangeTo,
Libraries.AssetManager  assetM 
)

Change the color type of the given piece to be the type passed. If the piece isn't listed in the allowed color types, this won't do anything. The texture will be changed as well.

piece - Piece to change.
typeToChangeTo - Piece type to change the piece to.
assetM - Asset manager to get piece assets from.
int TheForum.GameCode.PieceGenerator.CheckForAvailablePieceType ( StringType  type) [protected]

Check the list of avaiable piece types for spawning and find the given type.

type - Piece type to check for. This could be a color, item, etc.

Return:
Value is the index in the list of where the type was found, -1 if not found.
int TheForum.GameCode.PieceGenerator.CheckForAvailablePieceType ( StringType  type) [protected]

Check the list of avaiable piece types for spawning and find the given type.

type - Piece type to check for. This could be a color, item, etc.

Return:
Value is the index in the list of where the type was found, -1 if not found.
Libraries._3D.BaseModel TheForum.GameCode.PieceGenerator.GenerateModelType ( StringType  type,
AssetManager  assetM 
)

Generate a piece model of the given type.

type - Piece type to create a model for.
assetM - Asset manager to use.

Return:
Value is the piece if it could be created, null if not.
BasePiece TheForum.GameCode.PieceGenerator.GenerateNonPiece ( string  tex,
StringType  shaderID,
AssetManager  assetM 
)

Generate a piece object that isn't a actual piece. It can be set with whatever texture you want. This should be what gets used to create things that look like pieces but aren't. That way you can be sure if you want to create something that looks like a piece it will actually look like a piece, be the proper dimensions. Don't just load a piece model on your own.

tex - Texture to use.
shaderID - ID of the shader to use.
assetM - Asset manager to use.

Return:
Value is the object if it could be created, null if not.
BasePiece TheForum.GameCode.PieceGenerator.GenerateType ( string  type,
AssetManager  assetM 
)

Generate a piece of the given type.

type - Piece type to create.
assetM - Asset manager to use.

Return:
Value is true if the property could be added, false if not.
BasePiece TheForum.GameCode.PieceGenerator.GenerateType ( string  type,
string  color,
AssetManager  assetM 
)

Generate a piece of the given type.

type - Piece type to create.
color - Color to use for the piece.
assetM - Asset manager to use.

Return:
Value is true if the property could be added, false if not.
BasePiece TheForum.GameCode.PieceGenerator.GenerateType ( StringType  type,
AssetManager  assetM 
)

Generate a piece of the given type.

type - Piece type to create.
assetM - Asset manager to use.

Return:
Value is true if the property could be added, false if not.
BasePiece TheForum.GameCode.PieceGenerator.GenerateType ( string  type,
AssetManager  assetM 
)

Generate a piece of the given type.

type - Piece type to create.
assetM - Asset manager to use.

Return:
Value is true if the property could be added, false if not.
BasePiece TheForum.GameCode.PieceGenerator.GenerateType ( string  type,
string  color,
AssetManager  assetM 
)

Generate a piece of the given type.

type - Piece type to create.
color - Color to use for the piece.
assetM - Asset manager to use.

Return:
Value is true if the property could be added, false if not.
BasePiece TheForum.GameCode.PieceGenerator.GenerateType ( StringType  type,
AssetManager  assetM 
)

Generate a piece of the given type.

type - Piece type to create.
assetM - Asset manager to use.

Return:
Value is the piece if it could be created, null if not.
BasePiece TheForum.GameCode.PieceGenerator.GenerateTypeColor ( StringType  type,
StringType  color,
AssetManager  assetM 
)

Generate a piece of the given type.

type - Piece type to create.
color - Piece color to use.
assetM - Asset manager to use.

Return:
Value is true if the property could be added, false if not.
BasePiece TheForum.GameCode.PieceGenerator.GenerateTypeColor ( StringType  type,
StringType  color,
AssetManager  assetM 
)

Generate a piece of the given type.

type - Piece type to create.
color - Piece color to use.
assetM - Asset manager to use.

Return:
Value is the piece if it could be created, false if not.
PieceDefinition TheForum.GameCode.PieceGenerator.GetDeff ( StringType  deffFind) [private]

Get the deffinition that corresponds to the given type.

type - Deffinition type to get.

Return:
Value is the deffinition if found, null if not.
PieceDefinition TheForum.GameCode.PieceGenerator.GetDeff ( StringType  deffFind)

Get the deffinition that corresponds to the given type.

deffFind - Deffinition type to get.

Return:
Value is the deffinition if found, null if not.
bool TheForum.GameCode.PieceGenerator.GetIs3DMode ( )

Get wether it is creating 3D pieces.

Return:
Value is true if it is in 3D mode, false if not.

Vector3 TheForum.GameCode.PieceGenerator.GetPieceCenterOffset ( )

Get where the center offset of a piece from the top left.

Return:
Value is the center of a piece.

Vector3 TheForum.GameCode.PieceGenerator.GetPieceCenterOffset ( )

Get where the center offset of a piece from the top left.

Return:
Value is the center of a piece.

VertexPositionNormalTexture [] TheForum.GameCode.PieceGenerator.GetPieceVertexData ( )

Retrives the 3D vertex data needed to setup a 3D piece.

Return:
Value is the array of vertex data. This array is created with new and can be changed by the caller.

VertexPositionNormalTexture [] TheForum.GameCode.PieceGenerator.GetPieceVertexData ( )

Retrives the 3D vertex data needed to setup a 3D piece.

Return:
Value is the array of vertex data. This array is created with new and can be changed by the caller.

void TheForum.GameCode.PieceGenerator.Initialize ( Libraries.AssetManager  assetM)
void TheForum.GameCode.PieceGenerator.Initialize ( Libraries.AssetManager  assetM)
StringType TheForum.GameCode.PieceGenerator.PickRandomPieceType ( )

Pick one of the available piece types at random.

Return:
Value is the piece type selected, null if none are available to select.

StringType TheForum.GameCode.PieceGenerator.PickRandomPieceType ( )

Pick one of the available piece types at random.

Return:
Value is the piece type selected, null if none are available to select.

void TheForum.GameCode.PieceGenerator.SetIs3DMode ( bool  use3DMode)

Set wether it is creating 3D pieces.

use3DMode - True if 3D pieces should be created, false if 2D.
void TheForum.GameCode.PieceGenerator.SetPieceRandomNumbers ( int  seed)

Set the seed for the random number generator used for selecting a random piece. Use this to keep things the same across multiple instances, always starting a game with the same key, etc.

seed - Value is seed to use.
void TheForum.GameCode.PieceGenerator.SetPieceRandomNumbers ( int  seed)

Set the seed for the random number generator used for selecting a random piece. Use this to keep things the same across multiple instances, always starting a game with the same key, etc.

seed - Value is seed to use.

Member Data Documentation

Pieces that are available to generate. This can be used to determine what random piece types are allowed to spawn.

Stores all the deffinitions in the object.

Singleton instance.

True if it is creating 3D pieces, false if not.

Size of the pieces.

Libraries _3D ModelVertexData ExtractModelData ModelDataPosNormTex TheForum::GameCode.PieceGenerator::m_pieceExtraction [protected]

Store the extracted model data to use when creating a piece.

The random number generator that is used when picking the random pieces. This way it is seperate from other random stuff and I can keep things the same across multiple instances.


Property Documentation

static PieceGenerator TheForum::GameCode.PieceGenerator::Instance [static, get]

Getter. Retrive the instance of the singleton version of the class.

Vector3 TheForum::GameCode.PieceGenerator::PieceDimensions [get, set]

Getter/setter for the dimensions used when creating the points that make up a piece.

Return:
Value is the world dimensions of the piece.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Properties