Grail (C#)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Grail.Planners.WorldObjectType Class Reference

A class that represents the type of WorldObject used in planners.
It essentially holds a unique ID determining the type, the name and inheritance structure (types and therefore objects can be organized into inheritance structures). More...

Inheritance diagram for Grail.Planners.WorldObjectType:
Collaboration diagram for Grail.Planners.WorldObjectType:

Public Member Functions

 WorldObjectType (string name, List< string > bases=null)
 Constructs a new WorldObjectType. This overload must be provided with the name and base types. Full WorldObjectType data construction is finished only after it is passed to the Domain class More...
 
 WorldObjectType (WorldObjectType other)
 Constructs a new WorldObjectType. As a copy constructor, this overload uses an existing type to copy from. More...
 
bool IsOfType (int type)
 
Returns
true if at least one of the types of the current WorldObjectType instance is equal to the provided type . It includes the inheritance hierarchy.

 
bool IsOfType (string name)
 
Returns
true if at least one of the types of the current WorldObjectType instance has the provided name . It includes the inheritance hierarchy.

 
void InheritFromType (WorldObjectType type)
 Makes the type represented by the current WorldObjectType inherit from the provided type.
In practice, it consists in merging parameters from the provided type and adding it to the base types. More...
 
WorldObject InstantiateObject ()
 Constructs a new WorldObject of this type. More...
 
- Public Member Functions inherited from Grail.Planners.ParametrizedObject
void MergeParameters (ParametrizedObject other)
 Adds parameters from the other object to the own one, replacing parameters with those of other in case of conflict. More...
 
int GetParametersSize ()
 
Returns
The number of parameters assigned to this object

 
bool Contains (string name)
 
Returns
true if the object contains a parameter with the given name, false otherwise

 
void SetParameter< ParameterType > (string name, ParameterType value)
 Sets a value of a parameter identified by the given name. More...
 
ParameterType GetParameterValue< ParameterType > (string name)
 Fetches the value of a parameter identified with the given name as a given ParameterType. Make sure to provide the correct ParameterType. More...
 
bool CollectionContains (string collectionName, int objectIndex)
 
void AddCollection (string collectionName)
 Creates a named collection object, which can be used to group many IDs of objects together.
The name should be unique or you will otherwise override an existing collection. More...
 
SortedSet< int > GetCollection (string collectionName)
 
bool HasEqualParams (ParametrizedObject other)
 
Returns
true if the other object contains identical set of parameters (including the contents of collections)

 

Public Attributes

string Name => name
 Returns the name of the type. More...
 
List< string > BaseTypes => baseTypes
 Returns the types that are higher in the inheritance structure, i.e., direct and indirect predecessors. More...
 

Properties

int TypeIndex [get, set]
 Returns a unique identification number that represents this type. It can be used, for instance, to compare whether two types are the same. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Grail.Planners.ParametrizedObject
 ParametrizedObject (ParametrizedObject other)
 

Detailed Description

A class that represents the type of WorldObject used in planners.
It essentially holds a unique ID determining the type, the name and inheritance structure (types and therefore objects can be organized into inheritance structures).

Constructor & Destructor Documentation

◆ WorldObjectType() [1/2]

Grail.Planners.WorldObjectType.WorldObjectType ( string  name,
List< string >  bases = null 
)
inline

Constructs a new WorldObjectType. This overload must be provided with the name and base types. Full WorldObjectType data construction is finished only after it is passed to the Domain class

Parameters
nameThe name of the type.
basesThe names of types that are higher along the path up in the inheritance hierarchy.

◆ WorldObjectType() [2/2]

Grail.Planners.WorldObjectType.WorldObjectType ( WorldObjectType  other)
inline

Constructs a new WorldObjectType. As a copy constructor, this overload uses an existing type to copy from.

Parameters
otherThe new type will become a copy of the provided other

Member Function Documentation

◆ InheritFromType()

void Grail.Planners.WorldObjectType.InheritFromType ( WorldObjectType  type)
inline

Makes the type represented by the current WorldObjectType inherit from the provided type.
In practice, it consists in merging parameters from the provided type and adding it to the base types.

Parameters
typeThe type to inherit from.

◆ InstantiateObject()

WorldObject Grail.Planners.WorldObjectType.InstantiateObject ( )
inline

Constructs a new WorldObject of this type.

Member Data Documentation

◆ BaseTypes

List<string> Grail.Planners.WorldObjectType.BaseTypes => baseTypes

Returns the types that are higher in the inheritance structure, i.e., direct and indirect predecessors.

◆ Name

string Grail.Planners.WorldObjectType.Name => name

Returns the name of the type.

Property Documentation

◆ TypeIndex

int Grail.Planners.WorldObjectType.TypeIndex
getset

Returns a unique identification number that represents this type. It can be used, for instance, to compare whether two types are the same.


The documentation for this class was generated from the following file: