Drag[en]gine Script Module DragonScript
1.23
|
Behavior element behavior adding conversation support. More...
Classes | |
class | Instance |
Behavior instance. More... | |
Public Member Functions | |
void | dispose () |
Dispose of behavior. More... | |
ECPStringID | getAddPlayer () |
Add player to conversation with identifier or null otherwise. More... | |
ECPConversation | getConversation () |
Conversation. More... | |
ECBehaviorConversationActor | getConversationActor () |
Conversation actor behavior or null if not used. More... | |
ECPBoolean | getDirectCamera () |
Conversation directs camera. More... | |
ECBehaviorPlayerControllable.Tracker | getPlayerControlledActor () |
Player controlled actor or null. More... | |
ECPStringID | getTopic () |
Topic to use for conversation. More... | |
ECPStringID | getTopicGroup () |
Topic group to use for conversation. More... | |
ECBehaviorTriggered | getTriggered () |
Trigger conversation. More... | |
Instance | instance (BehaviorElement element) |
Get instance in element from owner element class. More... | |
ECBehaviorConversation | new (BehaviorElementClass eclass) |
Create behavior element class. More... | |
ECBehaviorConversation | new (BehaviorElementClass eclass, Loaders loaders, TSTriggerTable triggerTable, ECBehaviorPlayerControllable.Tracker playerControlledActor) |
Create behavior element class. More... | |
ECBehaviorConversation | new (BehaviorElementClass eclass, Loaders loaders, TSTriggerTable triggerTable, ECBehaviorPlayerControllable.Tracker playerControlledActor, String id) |
Create behavior element class. More... | |
ECBehaviorConversation | new (BehaviorElementClass eclass, Loaders loaders, TSTriggerTable triggerTable, ECBehaviorPlayerControllable.Tracker playerControlledActor, String id, String subID) |
ECBehaviorConversation | new (BehaviorElementClass eclass, Loaders loaders, TSTriggerTable triggerTable, ECBehaviorPlayerControllable.Tracker playerControlledActor, String id, String subID, String prefix) |
ECBehaviorConversation | new (BehaviorElementClass eclass, String id) |
Create behavior element class. More... | |
ECBehaviorConversation | new (BehaviorElementClass eclass, String id, String prefix) |
Create behavior element class. More... | |
void | setConversationActor (ECBehaviorConversationActor conversationActor) |
Set conversation actor behavior or null if not used. More... | |
void | setPlayerControlledActor (ECBehaviorPlayerControllable.Tracker playerControlledActor) |
Set player controllable tracker or null. More... | |
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
void | assignInstanceIndex (int instanceIndex) |
Assign instance index. More... | |
String | getBehaviorID () |
Unique identifier of behavior. More... | |
String | getID () |
Identifier. More... | |
int | getInstanceIndex () |
Instance index. More... | |
void | loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance) |
Load instance data of another behavior. More... | |
bool | supportsBehaviorID (String identifier) |
Behavior supports loading instance data of another behavior. More... | |
Public Member Functions inherited from Dragengine.Scenery.ECBehavior | |
ECBehaviorInstance | createInstance (BehaviorElement element) |
Create Behavior instance. More... | |
Static Public Member Functions | |
static ECBehaviorConversation | getBehaviorIn (BehaviorElementClass eclass) |
Get behavior in element class or null if absent. More... | |
Public Attributes | |
ECPStringID | pAddPlayer |
ECPConversation | pConversation |
ECBehaviorConversationActor | pConversationActor |
ECPBoolean | pDirectCamera |
ECBehaviorPlayerControllable.Tracker | pPlayerControlledActor |
ECPStringID | pTopic |
ECPStringID | pTopicGroup |
ECBehaviorTriggered | pTriggered |
Additional Inherited Members | |
Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
void | setBehaviorID (String identifier) |
Set behavior identifier. More... | |
void | useClassNameAsBehaviorID () |
Set behavior identifier to "<class-name>:<identifier>". More... | |
void | useFullyQualifiedClassNameAsBehaviorID () |
Set behavior identifier to "<fully-qualified-class-name>:<identifier>". More... | |
Behavior element behavior adding conversation support.
Loads a conversation resource file and allows to start a conversation using a user defined topic. Conversations are loaded once so multiple behaviors can load the same conversation file without doing the actual loading multiple times.
By default the conversation is started without adding any actors.
If the "addPlayer" stub property is not empty string the BaseGameApp.getPlayerControlledActor() actor is added to the conversation as first actor using the property value as its alias id. If the actor does not have a BaseActorConversation assigned an exception is thrown. The default element class property sets AddPlayer to "player".
If ECBehaviorConversationActor is present and has a conversation actor it is added as second actor to the conversation using the property valus as id. Additional actors can be added using conversation actions.
If the "directCamera" stub property is true the conversation does direct the camera using ConversationCameraDirector instance. The default element class property sets DirectCamera to true. Set this property to false to keep the camera unchanged which is required to do first person camera animations.
Starting the conversation can be done by calling startConversation(). This can be done by other behaviors or a subclass. Care has to be taken when starting conversation if another conversation is running. Actors are not allowed to be involved in more than one conversation but any number of conversation can be running at the same time as long as this rule is fulfilled.
To protect against this situation the method canStartConversation() is provided. It checks if the player and this behavior element have a ConversationActor and are both not involved in a conversation (given they are used for the conversation).
A typical use pattern is to start a conversation with a suitable element if the player "uses" said element. The code example below shows how this can be done in a simple way.
It checks if a behavior element has the ECBehaviorConversation behavior present. If this is the case it checks if the conversation can be started and starts it.
Another way to start a conversation is using the triggerConversation. If this trigger expression is not empty it will be used to start the conversation if the trigger expression evaluates to true. The method canStartConversation() is used to not check if the conversation is possible. If the check fails an exception is thrown to not silently not start a conversation.
This method is typically used to trigger conversation if the player enters a TriggerTouch or he finished a sequence of actions ending in firing a trigger.
This element behavior can be present only once in a BehaviorElement. Trying to add more than one instance results in an exception thrown.
Element class properties have the prefix "conversation.".
This behavior does require the element class to be persistable (setPersistable).
void Dragengine.Scenery.ECBehaviorConversation.dispose | ( | ) |
Dispose of behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
ECPStringID Dragengine.Scenery.ECBehaviorConversation.getAddPlayer | ( | ) |
Add player to conversation with identifier or null otherwise.
|
static |
Get behavior in element class or null if absent.
Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorConversation.
ECPConversation Dragengine.Scenery.ECBehaviorConversation.getConversation | ( | ) |
Conversation.
ECBehaviorConversationActor Dragengine.Scenery.ECBehaviorConversation.getConversationActor | ( | ) |
Conversation actor behavior or null if not used.
ECPBoolean Dragengine.Scenery.ECBehaviorConversation.getDirectCamera | ( | ) |
Conversation directs camera.
ECBehaviorPlayerControllable.Tracker Dragengine.Scenery.ECBehaviorConversation.getPlayerControlledActor | ( | ) |
Player controlled actor or null.
ECPStringID Dragengine.Scenery.ECBehaviorConversation.getTopic | ( | ) |
Topic to use for conversation.
ECPStringID Dragengine.Scenery.ECBehaviorConversation.getTopicGroup | ( | ) |
Topic group to use for conversation.
ECBehaviorTriggered Dragengine.Scenery.ECBehaviorConversation.getTriggered | ( | ) |
Trigger conversation.
Instance Dragengine.Scenery.ECBehaviorConversation.instance | ( | BehaviorElement | element | ) |
Get instance in element from owner element class.
ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new | ( | BehaviorElementClass | eclass | ) |
Create behavior element class.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new | ( | BehaviorElementClass | eclass, |
Loaders | loaders, | ||
TSTriggerTable | triggerTable, | ||
ECBehaviorPlayerControllable.Tracker | playerControlledActor | ||
) |
Create behavior element class.
ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new | ( | BehaviorElementClass | eclass, |
Loaders | loaders, | ||
TSTriggerTable | triggerTable, | ||
ECBehaviorPlayerControllable.Tracker | playerControlledActor, | ||
String | id | ||
) |
Create behavior element class.
ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new | ( | BehaviorElementClass | eclass, |
Loaders | loaders, | ||
TSTriggerTable | triggerTable, | ||
ECBehaviorPlayerControllable.Tracker | playerControlledActor, | ||
String | id, | ||
String | subID | ||
) |
ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new | ( | BehaviorElementClass | eclass, |
Loaders | loaders, | ||
TSTriggerTable | triggerTable, | ||
ECBehaviorPlayerControllable.Tracker | playerControlledActor, | ||
String | id, | ||
String | subID, | ||
String | prefix | ||
) |
ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new | ( | BehaviorElementClass | eclass, |
String | id | ||
) |
Create behavior element class.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new | ( | BehaviorElementClass | eclass, |
String | id, | ||
String | prefix | ||
) |
Create behavior element class.
void Dragengine.Scenery.ECBehaviorConversation.setConversationActor | ( | ECBehaviorConversationActor | conversationActor | ) |
Set conversation actor behavior or null if not used.
void Dragengine.Scenery.ECBehaviorConversation.setPlayerControlledActor | ( | ECBehaviorPlayerControllable.Tracker | playerControlledActor | ) |
Set player controllable tracker or null.
ECPStringID Dragengine.Scenery.ECBehaviorConversation.pAddPlayer |
ECPConversation Dragengine.Scenery.ECBehaviorConversation.pConversation |
ECBehaviorConversationActor Dragengine.Scenery.ECBehaviorConversation.pConversationActor |
ECPBoolean Dragengine.Scenery.ECBehaviorConversation.pDirectCamera |
ECBehaviorPlayerControllable.Tracker Dragengine.Scenery.ECBehaviorConversation.pPlayerControlledActor |
ECPStringID Dragengine.Scenery.ECBehaviorConversation.pTopic |
ECPStringID Dragengine.Scenery.ECBehaviorConversation.pTopicGroup |
ECBehaviorTriggered Dragengine.Scenery.ECBehaviorConversation.pTriggered |