Every object in the world that has a script has a context. This includes players, NPCs, props, etc. A context is the generic reference to an object. Static props, and terrain, do not have a script or a context. Every event passes along a context and every receiver takes a context. This allows you to know who causes the chain of events. If a player pulls a lever, they are the context. If that lever is wired to a door, who opened the door? The player! This chain of events allows the door script to perform additional logic, like giving that player a coin for opening it, when otherwise, it wouldn't know what caused it to open.
More...
|
bool | IsNpc () |
| Quick checker for is this context representing an NPC?
|
|
bool | IsPlayer () |
| Quick check for is this context representing a player?
|
|
void | SetFloat (string name, float value) |
| Sets a float on this object's blackboard. Any script can set or retrieve info from a context's blackboard. Values are saved between levels.
|
|
float | GetFloat (string name) |
| Gets a named int saved on this context's blackboard.
|
|
void | SetInt (string name, int value) |
| Sets a int on this object's blackboard. Any script can set or retrieve info from a context's blackboard. Values are saved between levels.
|
|
int | GetInt (string name) |
| Gets a named int saved on this context's blackboard.
|
|
void | SetBool (string name, bool value) |
| Sets a boolean on this object's blackboard. Any script can set or retrieve info from a context's blackboard. Values are saved between levels.
|
|
bool | GetBool (string name) |
| Gets a named boolean saved on this context's blackboard.
|
|
void | SetString (string name, string value) |
| Sets a string on this object's blackboard. Any script can set or retrieve info from a context's blackboard. Values are saved between levels.
|
|
string | GetString (string name) |
| Gets a named boolean saved on this context's blackboard.
|
|
bool | HasMember (string name) |
| Does this context have a saved value of any type with the given name?
|
|
object | TryGetComponent (string componentName) |
| One of the most important methods! This allows you to access any component on an object who's context you have After attempting to retrieve a component be sure to check that it is not nil (It will be nil if the context does not have the requested component) Example Usage: context.TryGetComponent(Component.Player)
|
|
Every object in the world that has a script has a context. This includes players, NPCs, props, etc. A context is the generic reference to an object. Static props, and terrain, do not have a script or a context. Every event passes along a context and every receiver takes a context. This allows you to know who causes the chain of events. If a player pulls a lever, they are the context. If that lever is wired to a door, who opened the door? The player! This chain of events allows the door script to perform additional logic, like giving that player a coin for opening it, when otherwise, it wouldn't know what caused it to open.
◆ GetBool()
bool GetBool |
( |
string | name | ) |
|
Gets a named boolean saved on this context's blackboard.
- Parameters
-
- Returns
- Defaults to false if not found
◆ GetFloat()
float GetFloat |
( |
string | name | ) |
|
Gets a named int saved on this context's blackboard.
- Parameters
-
- Returns
- Defaults to 0 if not found
◆ GetInt()
int GetInt |
( |
string | name | ) |
|
Gets a named int saved on this context's blackboard.
- Parameters
-
- Returns
- Defaults to 0 if not found
◆ GetString()
string GetString |
( |
string | name | ) |
|
Gets a named boolean saved on this context's blackboard.
- Parameters
-
- Returns
- Defaults to an empty string if not found
◆ HasMember()
bool HasMember |
( |
string | name | ) |
|
Does this context have a saved value of any type with the given name?
- Parameters
-
name | The name of the variable you are checking for |
- Returns
◆ IsNpc()
Quick checker for is this context representing an NPC?
- Returns
◆ IsPlayer()
Quick check for is this context representing a player?
- Returns
◆ SetBool()
void SetBool |
( |
string | name, |
|
|
bool | value ) |
Sets a boolean on this object's blackboard. Any script can set or retrieve info from a context's blackboard. Values are saved between levels.
- Parameters
-
name | The name of the value you're setting. You must use the exact name to access this value later. |
value | The value to save |
◆ SetFloat()
void SetFloat |
( |
string | name, |
|
|
float | value ) |
Sets a float on this object's blackboard. Any script can set or retrieve info from a context's blackboard. Values are saved between levels.
- Parameters
-
name | The name of the value you're setting. You must use the exact name to access this value later. |
value | The value to save |
◆ SetInt()
void SetInt |
( |
string | name, |
|
|
int | value ) |
Sets a int on this object's blackboard. Any script can set or retrieve info from a context's blackboard. Values are saved between levels.
- Parameters
-
name | The name of the value you're setting. You must use the exact name to access this value later. |
value | The value to save |
◆ SetString()
void SetString |
( |
string | name, |
|
|
string | value ) |
Sets a string on this object's blackboard. Any script can set or retrieve info from a context's blackboard. Values are saved between levels.
- Parameters
-
name | The name of the value you're setting. You must use the exact name to access this value later. |
value | The value to save |
◆ TryGetComponent()
object TryGetComponent |
( |
string | componentName | ) |
|
One of the most important methods! This allows you to access any component on an object who's context you have After attempting to retrieve a component be sure to check that it is not nil (It will be nil if the context does not have the requested component) Example Usage: context.TryGetComponent(Component.Player)
- Parameters
-
- Returns
- nil if the component is not present
◆ GameContext
◆ LastContext
◆ LevelContext