Drag[en]gine Script Module DragonScript
1.23
|
Base actor action. More...
Classes | |
class | Factory |
Factory for loading actor actions. More... | |
Public Member Functions | |
void | activate (BehaviorElement actor) |
Action has been set as active action in an actor. More... | |
void | activateWhileLoading (BehaviorElement actor) |
Action has been set as active action in an actor while loading. More... | |
void | aiFailed () |
Notify actor AI this action failed. More... | |
void | aiFinished () |
Notify actor AI this action failed. More... | |
void | cancel () |
Cancel action the next time possible. More... | |
bool | canHitCollider (Collider owner, Collider collider) |
Two colliders can hit each other. More... | |
void | colliderChanged (Collider owner) |
Collider changed. More... | |
void | collisionResponse (Collider owner, CollisionInfo info) |
Collision detected. More... | |
bool | conversationWait () |
Check if conversation actions have to wait for actor to finish this action. More... | |
void | deactivate () |
Action has been unset as active action in an actor. More... | |
void | dispose () |
Dispose of actor action. More... | |
void | enteredGameWorld () |
Actor entered game world. More... | |
void | enterFrame () |
Actor has been added to game world and enterFrame() is called once. More... | |
BehaviorElement | getActor () |
Actor the action is assigned to or null. More... | |
ECBehaviorActorAnimated.Instance | getActorAnimated () |
Actor animated behavior if present. More... | |
ECBehaviorActorAIAction.Instance | getAIAction () |
Behavior actor ai-action or null. More... | |
ECBehaviorConversationActor.Instance | getConversationActor () |
Conversation actor behavior if present. More... | |
ECBehaviorLocomotion.Instance | getLocomotion () |
Locomotion behavior. More... | |
ECBehaviorPlayerControllable.Instance | getPlayerControllable () |
Behavior player controllable or null. More... | |
bool | isActive () |
Action is active actor action. More... | |
bool | isControlledByPlayer () |
Actor is controlled by player. More... | |
bool | isNotActive () |
Action is not active actor action. More... | |
void | leftGameWorld () |
Actor left game world. More... | |
void | log (Console console, Element element, String text) |
Log text about element to console prefixed with actor information. More... | |
void | log (Console console, Exception exception) |
Log exception to console prefixed with actor information. More... | |
void | log (Console console, String text) |
Log text to console prefixed with actor information. More... | |
void | log (Element element, String text) |
Log text about element to BaseGameApp console prefixed with actor information. More... | |
void | log (Exception exception) |
Log exception to BaseGameApp console prefixed with actor information. More... | |
void | log (String text) |
Log text to BaseGameApp console prefixed with actor information. More... | |
String | loggingPrefix () |
Logging prefix. More... | |
BaseActorAction | new () |
Create actor action. More... | |
BaseActorAction | new (PersistencyEnvironment env, FileReader reader) |
Create actor action from persisted state. More... | |
String | persistencyFactoryName () |
Name of PersistencyFactory required to load object from file. More... | |
void | playerPostThink (float elapsed) |
Post physics for player controlled actor only. More... | |
void | playerReleasesControl () |
Player released control of actor. More... | |
void | playerTakesControl () |
Player takes control of actor. More... | |
void | playerThink (float elapsed) |
Thinking for player controlled actor only. More... | |
void | postThink (float elapsed) |
Post physics. More... | |
void | think (float elapsed) |
Thinking. More... | |
void | writeObjectToFile (PersistencyEnvironment env, FileWriter writer) |
Write object to file writer. More... | |
Protected Member Functions | |
void | applyAnimations () |
Apply animations. More... | |
void | initAnimator () |
Initialize animator. More... | |
void | initBehaviors () |
Init behaviors. More... | |
void | updateAICollider (float elapsed) |
Update AI collider. More... | |
void | updateAnimator (float elapsed) |
Update animator controllers. More... | |
void | updateLocomotion (float elapsed) |
Update locomotion. More... | |
Protected Attributes | |
BehaviorElement | actor |
Actor the action is assigned to or null. More... | |
ECBehaviorActorAnimated.Instance | actorAnimated |
Actor animated behavior if present. More... | |
ECBehaviorActorAIAction.Instance | aiAction |
Behavior actor ai-action or null. More... | |
ECBehaviorConversationActor.Instance | conversationActor |
Conversation actor behavior if present. More... | |
ECBehaviorLocomotion.Instance | locomotion |
Locomotion behavior. More... | |
ECBehaviorPlayerControllable.Instance | playerControllable |
Behavior player controllable or null. More... | |
Base actor action.
Action supports the Persistable interface an can be read from and writen to file writers.
void Dragengine.Scenery.BaseActorAction.activate | ( | BehaviorElement | actor | ) |
Action has been set as active action in an actor.
Stores the actor and calls initAnimator() and ECBehaviorActorAnimated.applyAnimations().
Calls these hook methods:
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAACutscene, and Dragengine.Scenery.BAAAlignActor.
void Dragengine.Scenery.BaseActorAction.activateWhileLoading | ( | BehaviorElement | actor | ) |
Action has been set as active action in an actor while loading.
Similar to activate(BehaviorElement) but only stores the actor and calls initBehaviors(). This is required since while loading behaviors load their state and actions load their states. If activate(BehaviorElement) is called these states would be reset to initial values.
void Dragengine.Scenery.BaseActorAction.aiFailed | ( | ) |
Notify actor AI this action failed.
Calls actionFailed() on actor AI if all of these conditions apply:
void Dragengine.Scenery.BaseActorAction.aiFinished | ( | ) |
Notify actor AI this action failed.
Calls actionFinished() on actor AI if all of these conditions apply:
|
protected |
Apply animations.
Default implementation calls these method if the behvaiors are present:
void Dragengine.Scenery.BaseActorAction.cancel | ( | ) |
Cancel action the next time possible.
Calls aiFailed().
Reimplemented in Dragengine.Scenery.BAAAlignActor.
Two colliders can hit each other.
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAACutscene, and Dragengine.Scenery.BAAAlignActor.
void Dragengine.Scenery.BaseActorAction.colliderChanged | ( | Collider | owner | ) |
Collider changed.
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAACutscene, and Dragengine.Scenery.BAAAlignActor.
void Dragengine.Scenery.BaseActorAction.collisionResponse | ( | Collider | owner, |
CollisionInfo | info | ||
) |
Collision detected.
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPerson, and Dragengine.Scenery.BAACutscene.
bool Dragengine.Scenery.BaseActorAction.conversationWait | ( | ) |
Check if conversation actions have to wait for actor to finish this action.
BaseActor adds a listener to ECBehaviorConversationActor using conversationWait() to answer waiting queries by conversation scripts.
The default implementation returns false which equals no waiting required.
void Dragengine.Scenery.BaseActorAction.deactivate | ( | ) |
Action has been unset as active action in an actor.
The stored actor is not cleared to allow aiFinished() and aiFailed() calls to function.
Reimplemented in Dragengine.Scenery.BAAAlignActor.
void Dragengine.Scenery.BaseActorAction.dispose | ( | ) |
Dispose of actor action.
void Dragengine.Scenery.BaseActorAction.enteredGameWorld | ( | ) |
Actor entered game world.
void Dragengine.Scenery.BaseActorAction.enterFrame | ( | ) |
Actor has been added to game world and enterFrame() is called once.
Reimplemented in Dragengine.Scenery.BAAAlignActor.
BehaviorElement Dragengine.Scenery.BaseActorAction.getActor | ( | ) |
Actor the action is assigned to or null.
ECBehaviorActorAnimated.Instance Dragengine.Scenery.BaseActorAction.getActorAnimated | ( | ) |
Actor animated behavior if present.
ECBehaviorActorAIAction.Instance Dragengine.Scenery.BaseActorAction.getAIAction | ( | ) |
Behavior actor ai-action or null.
ECBehaviorConversationActor.Instance Dragengine.Scenery.BaseActorAction.getConversationActor | ( | ) |
Conversation actor behavior if present.
ECBehaviorLocomotion.Instance Dragengine.Scenery.BaseActorAction.getLocomotion | ( | ) |
Locomotion behavior.
ECBehaviorPlayerControllable.Instance Dragengine.Scenery.BaseActorAction.getPlayerControllable | ( | ) |
Behavior player controllable or null.
|
protected |
Initialize animator.
Overwrite to change animator to use for this actor.
Default implementation does nothing.
Call setActiveAnimatorID() with the identifier of the desired animator as set up in the "actorAnimated.animators" element class property. If you set up controller mappings using actorAnimated.setDefaultControllerMappings() or manually you can stop here since controller mappings are automatically updated. By default BaseActorClass does calls setDefaultControllerMappings().
A typical implementation can look like this:
If you change the animator you should usually also change the locomotion controller mappings to automatically animate them unless you plan to do it manually.
A typical implementation can look like this:
This example code sets an animator which is known to have 4 controllers. The mappings are set to automatically update the controllers with values matching their use. In this case the first controller is playback while actor is not moving. The second controller is playback while actor is walking. Using ATTR_DISPLACEMENT uses the distance moved by the actor as controller value. Using distance avoids feet shuffling and works well with variable movement speeds. The other two controllers affect the direction the actor is looking.
|
protected |
Init behaviors.
Retrieve and store required and optional behavior instances from the actor element.
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPersonVR, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAACutscene, and Dragengine.Scenery.BAAAlignActor.
bool Dragengine.Scenery.BaseActorAction.isActive | ( | ) |
Action is active actor action.
bool Dragengine.Scenery.BaseActorAction.isControlledByPlayer | ( | ) |
Actor is controlled by player.
bool Dragengine.Scenery.BaseActorAction.isNotActive | ( | ) |
Action is not active actor action.
void Dragengine.Scenery.BaseActorAction.leftGameWorld | ( | ) |
Actor left game world.
Log text about element to console prefixed with actor information.
void Dragengine.Scenery.BaseActorAction.log | ( | Console | console, |
Exception | exception | ||
) |
Log exception to console prefixed with actor information.
void Dragengine.Scenery.BaseActorAction.log | ( | Console | console, |
String | text | ||
) |
Log text to console prefixed with actor information.
void Dragengine.Scenery.BaseActorAction.log | ( | Element | element, |
String | text | ||
) |
Log text about element to BaseGameApp console prefixed with actor information.
void Dragengine.Scenery.BaseActorAction.log | ( | Exception | exception | ) |
Log exception to BaseGameApp console prefixed with actor information.
void Dragengine.Scenery.BaseActorAction.log | ( | String | text | ) |
Log text to BaseGameApp console prefixed with actor information.
String Dragengine.Scenery.BaseActorAction.loggingPrefix | ( | ) |
Logging prefix.
Returns string in the form "<actor-class>/<action-class>".
BaseActorAction Dragengine.Scenery.BaseActorAction.new | ( | ) |
Create actor action.
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPersonVR, Dragengine.Scenery.BAAFirstPerson, and Dragengine.Scenery.BAACutscene.
BaseActorAction Dragengine.Scenery.BaseActorAction.new | ( | PersistencyEnvironment | env, |
FileReader | reader | ||
) |
Create actor action from persisted state.
Reimplemented in Dragengine.Scenery.BAACutscene, and Dragengine.Scenery.BAAAlignActor.
String Dragengine.Scenery.BaseActorAction.persistencyFactoryName | ( | ) |
Name of PersistencyFactory required to load object from file.
Name of PersistencyFactory is first written to the file as string with 8-bit length. Then writeToFile() is called to write the object itself. Empty name is not allowed as is names longer than 255 characters. Name has to match a PersistencyFactory present in the Persistency instance used for loading objects. Object is read using PersistencyFactory.readObjectFromFile() of the matching PersistencyFactory.
Implements Dragengine.LoadSave.Persistable.
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPersonVR, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAACutscene, and Dragengine.Scenery.BAAAlignActor.
void Dragengine.Scenery.BaseActorAction.playerPostThink | ( | float | elapsed | ) |
Post physics for player controlled actor only.
Default implementation does nothing.
void Dragengine.Scenery.BaseActorAction.playerReleasesControl | ( | ) |
Player released control of actor.
Reimplemented in Dragengine.Scenery.BAAVehicle, and Dragengine.Scenery.BAAFirstPerson.
void Dragengine.Scenery.BaseActorAction.playerTakesControl | ( | ) |
Player takes control of actor.
Reimplemented in Dragengine.Scenery.BAAVehicle, and Dragengine.Scenery.BAAFirstPerson.
void Dragengine.Scenery.BaseActorAction.playerThink | ( | float | elapsed | ) |
Thinking for player controlled actor only.
Default implementation does nothing.
Reimplemented in Dragengine.Scenery.BAAVehicle, and Dragengine.Scenery.BAAFirstPerson.
void Dragengine.Scenery.BaseActorAction.postThink | ( | float | elapsed | ) |
Post physics.
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPerson, and Dragengine.Scenery.BAACutscene.
void Dragengine.Scenery.BaseActorAction.think | ( | float | elapsed | ) |
Thinking.
Default implementation does these actions in this order:
playerThink() is called by ECBehaviorActorAIAction if player controls this actor.
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAACutscene, and Dragengine.Scenery.BAAAlignActor.
|
protected |
Update AI collider.
Default implementation does nothing.
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPerson, and Dragengine.Scenery.BAACutscene.
|
protected |
Update animator controllers.
Default implementation calls these method if the behvaiors are present:
|
protected |
Update locomotion.
Default implementation does nothing.
Reimplemented in Dragengine.Scenery.BAAVehicle, Dragengine.Scenery.BAAFirstPerson, and Dragengine.Scenery.BAACutscene.
void Dragengine.Scenery.BaseActorAction.writeObjectToFile | ( | PersistencyEnvironment | env, |
FileWriter | writer | ||
) |
Write object to file writer.
Implements Dragengine.LoadSave.Persistable.
Reimplemented in Dragengine.Scenery.BAACutscene, and Dragengine.Scenery.BAAAlignActor.
|
protected |
Actor the action is assigned to or null.
|
protected |
Actor animated behavior if present.
|
protected |
Behavior actor ai-action or null.
|
protected |
Conversation actor behavior if present.
|
protected |
Locomotion behavior.
|
protected |
Behavior player controllable or null.