|
Drag[en]gine Script Module DragonScript 1.35
|
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. | |
| void | activateWhileLoading (BehaviorElement actor) |
| Action has been set as active action in an actor while loading. | |
| void | aiFailed () |
| Notify actor AI this action failed. | |
| void | aiFinished () |
| Notify actor AI this action failed. | |
| void | cancel () |
| Cancel action the next time possible. | |
| bool | canHitCollider (Collider owner, Collider collider) |
| Two colliders can hit each other. | |
| void | colliderChanged (Collider owner) |
| Collider changed. | |
| void | collisionResponse (Collider owner, CollisionInfo info) |
| Collision detected. | |
| bool | conversationWait () |
| Check if conversation actions have to wait for actor to finish this action. | |
| void | deactivate () |
| Action has been unset as active action in an actor. | |
| void | dispose () |
| Dispose of actor action. | |
| void | enteredGameWorld () |
| Actor entered game world. | |
| void | enterFrame () |
| Actor has been added to game world and enterFrame() is called once. | |
| BehaviorElement | getActor () |
| Actor the action is assigned to or null. | |
| ECBehaviorActorAnimated.Instance | getActorAnimated () |
| Actor animated behavior if present. | |
| ECBehaviorActorAIAction.Instance | getAIAction () |
| Behavior actor ai-action or null. | |
| ECBehaviorConversationActor.Instance | getConversationActor () |
| Conversation actor behavior if present. | |
| ECBehaviorLocomotion.Instance | getLocomotion () |
| Locomotion behavior. | |
| ECBehaviorPlayerControllable.Instance | getPlayerControllable () |
| Behavior player controllable or null. | |
| bool | isActive () |
| Action is active actor action. | |
| bool | isControlledByPlayer () |
| Actor is controlled by player. | |
| bool | isNotActive () |
| Action is not active actor action. | |
| void | leftGameWorld () |
| Actor left game world. | |
| void | log (Console console, Element element, String text) |
| Log text about element to console prefixed with actor information. | |
| void | log (Console console, Exception exception) |
| Log exception to console prefixed with actor information. | |
| void | log (Console console, String text) |
| Log text to console prefixed with actor information. | |
| void | log (Element element, String text) |
| Log text about element to BaseGameApp console prefixed with actor information. | |
| void | log (Exception exception) |
| Log exception to BaseGameApp console prefixed with actor information. | |
| void | log (String text) |
| Log text to BaseGameApp console prefixed with actor information. | |
| String | loggingPrefix () |
| Logging prefix. | |
| BaseActorAction | new () |
| Create actor action. | |
| BaseActorAction | new (PersistencyEnvironment env, FileReader reader) |
| Create actor action from persisted state. | |
| String | persistencyFactoryName () |
| Name of PersistencyFactory required to load object from file. | |
| void | playerPostThink (float elapsed) |
| Post physics for player controlled actor only. | |
| void | playerReleasesControl () |
| Player released control of actor. | |
| void | playerTakesControl () |
| Player takes control of actor. | |
| void | playerThink (float elapsed) |
| Thinking for player controlled actor only. | |
| void | postThink (float elapsed) |
| Post physics. | |
| void | think (float elapsed) |
| Thinking. | |
| void | writeObjectToFile (PersistencyEnvironment env, FileWriter writer) |
| Write object to file writer. | |
Protected Member Functions | |
| void | applyAnimations () |
| Apply animations. | |
| void | initAnimator () |
| Initialize animator. | |
| void | initBehaviors () |
| Init behaviors. | |
| void | updateAICollider (float elapsed) |
| Update AI collider. | |
| void | updateAnimator (float elapsed) |
| Update animator controllers. | |
| void | updateLocomotion (float elapsed) |
| Update locomotion. | |
Protected Attributes | |
| BehaviorElement | actor |
| Actor the action is assigned to or null. | |
| ECBehaviorActorAnimated.Instance | actorAnimated |
| Actor animated behavior if present. | |
| ECBehaviorActorAIAction.Instance | aiAction |
| Behavior actor ai-action or null. | |
| ECBehaviorConversationActor.Instance | conversationActor |
| Conversation actor behavior if present. | |
| ECBehaviorLocomotion.Instance | locomotion |
| Locomotion behavior. | |
| ECBehaviorPlayerControllable.Instance | playerControllable |
| Behavior player controllable or null. | |
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.BAAAlignActor, Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
References aiAction, and isActive().
Referenced by playerTakesControl().
| 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.
Reimplemented in Dragengine.Scenery.BAAStateMachine.
References aiAction, and isNotActive().
Referenced by think().
| void Dragengine.Scenery.BaseActorAction.aiFailed | ( | ) |
Notify actor AI this action failed.
Calls actionFailed() on actor AI if all of these conditions apply:
Referenced by initBehaviors().
| void Dragengine.Scenery.BaseActorAction.aiFinished | ( | ) |
Notify actor AI this action failed.
Calls actionFinished() on actor AI if all of these conditions apply:
References applyAnimations(), conversationActor, think(), updateAICollider(), updateAnimator(), and updateLocomotion().
Referenced by updateLocomotion(), and Dragengine.Scenery.BAAAlignActor.writeObjectToFile().
|
protected |
Apply animations.
Default implementation calls these method if the behaviors are present:
References actorAnimated, aiAction, conversationActor, getAIAction(), getPlayerControllable(), locomotion, and playerControllable.
Referenced by aiFinished(), playerReleasesControl(), and writeObjectToFile().
| void Dragengine.Scenery.BaseActorAction.cancel | ( | ) |
Cancel action the next time possible.
Calls aiFailed().
Reimplemented in Dragengine.Scenery.BAAAlignActor, and Dragengine.Scenery.BAAStateMachine.
References playerReleasesControl(), and playerTakesControl().
Referenced by initBehaviors().
Two colliders can hit each other.
Reimplemented in Dragengine.Scenery.BAAAlignActor, Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BaseActorAction.colliderChanged | ( | Collider | owner | ) |
Collider changed.
Reimplemented in Dragengine.Scenery.BAAAlignActor, Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BaseActorAction.collisionResponse | ( | Collider | owner, |
| CollisionInfo | info ) |
Collision detected.
Reimplemented in Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
Referenced by writeObjectToFile().
| 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.
Reimplemented in Dragengine.Scenery.BAAStateMachine.
Referenced by writeObjectToFile().
| 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.
Referenced by postThink().
| void Dragengine.Scenery.BaseActorAction.dispose | ( | ) |
Dispose of actor action.
Reimplemented in Dragengine.Scenery.BAAStateMachine.
References new().
Referenced by getLocomotion().
| void Dragengine.Scenery.BaseActorAction.enteredGameWorld | ( | ) |
Actor entered game world.
Reimplemented in Dragengine.Scenery.BAAStateMachine.
Referenced by postThink().
| void Dragengine.Scenery.BaseActorAction.enterFrame | ( | ) |
Actor has been added to game world and enterFrame() is called once.
Reimplemented in Dragengine.Scenery.BAAAlignActor, and Dragengine.Scenery.BAAStateMachine.
Referenced by playerPostThink().
| BehaviorElement Dragengine.Scenery.BaseActorAction.getActor | ( | ) |
| ECBehaviorActorAnimated.Instance Dragengine.Scenery.BaseActorAction.getActorAnimated | ( | ) |
Actor animated behavior if present.
References getActor().
Referenced by isActive(), and updateAnimator().
| ECBehaviorActorAIAction.Instance Dragengine.Scenery.BaseActorAction.getAIAction | ( | ) |
Behavior actor ai-action or null.
References getLocomotion(), and locomotion.
Referenced by applyAnimations(), and isNotActive().
| ECBehaviorConversationActor.Instance Dragengine.Scenery.BaseActorAction.getConversationActor | ( | ) |
Conversation actor behavior if present.
Referenced by isControlledByPlayer(), and updateAnimator().
| ECBehaviorLocomotion.Instance Dragengine.Scenery.BaseActorAction.getLocomotion | ( | ) |
Locomotion behavior.
References actor, and dispose().
Referenced by getAIAction(), Dragengine.Scenery.BAAAlignActor.initBehaviors(), Dragengine.Scenery.BAACutscene.initBehaviors(), Dragengine.Scenery.BAAFirstPerson.persistencyFactoryName(), Dragengine.Scenery.BAAFirstPersonVR.persistencyFactoryName(), and updateAnimator().
| ECBehaviorPlayerControllable.Instance Dragengine.Scenery.BaseActorAction.getPlayerControllable | ( | ) |
Behavior player controllable or null.
References actor.
Referenced by applyAnimations(), and isNotActive().
|
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.
Referenced by loggingPrefix(), and playerReleasesControl().
|
protected |
Init behaviors.
Retrieve and store required and optional behavior instances from the actor element.
Reimplemented in Dragengine.Scenery.BAAAlignActor, Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAFirstPersonVR, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
References aiAction, aiFailed(), cancel(), isControlledByPlayer(), playerPostThink(), playerThink(), and postThink().
Referenced by playerReleasesControl(), think(), and updateAnimator().
| bool Dragengine.Scenery.BaseActorAction.isActive | ( | ) |
Action is active actor action.
References actorAnimated, and getActorAnimated().
Referenced by activate(), and Dragengine.Scenery.BAAStateMachine.writeObjectToFile().
| bool Dragengine.Scenery.BaseActorAction.isControlledByPlayer | ( | ) |
Actor is controlled by player.
References conversationActor, and getConversationActor().
Referenced by initBehaviors(), isNotActive(), Dragengine.Scenery.BAAFirstPerson.think(), updateLocomotion(), and Dragengine.Scenery.BAAAlignActor.writeObjectToFile().
| bool Dragengine.Scenery.BaseActorAction.isNotActive | ( | ) |
Action is not active actor action.
References aiAction, getAIAction(), getPlayerControllable(), isControlledByPlayer(), and playerControllable.
Referenced by activateWhileLoading().
| void Dragengine.Scenery.BaseActorAction.leftGameWorld | ( | ) |
Actor left game world.
Reimplemented in Dragengine.Scenery.BAAStateMachine.
Referenced by playerPostThink().
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.
Referenced by writeObjectToFile().
| String Dragengine.Scenery.BaseActorAction.loggingPrefix | ( | ) |
Logging prefix.
Returns string in the form "<actor-class>/<action-class>".
References initAnimator().
Referenced by writeObjectToFile().
| BaseActorAction Dragengine.Scenery.BaseActorAction.new | ( | ) |
Create actor action.
Reimplemented in Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAFirstPersonVR, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
References aiAction.
Referenced by dispose(), and getActor().
| BaseActorAction Dragengine.Scenery.BaseActorAction.new | ( | PersistencyEnvironment | env, |
| FileReader | reader ) |
Create actor action from persisted state.
Reimplemented in Dragengine.Scenery.BAAAlignActor, Dragengine.Scenery.BAACutscene, and Dragengine.Scenery.BAAStateMachine.
| 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.BAAAlignActor, Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAFirstPersonVR, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BaseActorAction.playerPostThink | ( | float | elapsed | ) |
Post physics for player controlled actor only.
Default implementation does nothing.
Reimplemented in Dragengine.Scenery.BAAStateMachine.
References enterFrame(), and leftGameWorld().
Referenced by initBehaviors().
| void Dragengine.Scenery.BaseActorAction.playerReleasesControl | ( | ) |
Player released control of actor.
Reimplemented in Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
References actorAnimated, applyAnimations(), initAnimator(), and initBehaviors().
Referenced by cancel().
| void Dragengine.Scenery.BaseActorAction.playerTakesControl | ( | ) |
Player takes control of actor.
Reimplemented in Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
References activate(), and actor.
Referenced by cancel().
| void Dragengine.Scenery.BaseActorAction.playerThink | ( | float | elapsed | ) |
Thinking for player controlled actor only.
Default implementation does nothing.
Reimplemented in Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
Referenced by initBehaviors().
| void Dragengine.Scenery.BaseActorAction.postThink | ( | float | elapsed | ) |
Post physics.
Reimplemented in Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
References deactivate(), and enteredGameWorld().
Referenced by initBehaviors().
| 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.BAAAlignActor, Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, Dragengine.Scenery.BAAStateMachine, and Dragengine.Scenery.BAAVehicle.
References activateWhileLoading(), actor, and initBehaviors().
Referenced by aiFinished().
|
protected |
Update AI collider.
Default implementation does nothing.
Reimplemented in Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, and Dragengine.Scenery.BAAVehicle.
References aiAction.
Referenced by aiFinished(), and writeObjectToFile().
|
protected |
Update animator controllers.
Default implementation calls these method if the behaviors are present:
References actor, actorAnimated, conversationActor, getActorAnimated(), getConversationActor(), getLocomotion(), initBehaviors(), and locomotion.
Referenced by aiFinished(), and writeObjectToFile().
|
protected |
Update locomotion.
Default implementation does nothing.
Reimplemented in Dragengine.Scenery.BAACutscene, Dragengine.Scenery.BAAFirstPerson, and Dragengine.Scenery.BAAVehicle.
References aiAction, aiFinished(), and isControlledByPlayer().
Referenced by aiFinished(), and writeObjectToFile().
| void Dragengine.Scenery.BaseActorAction.writeObjectToFile | ( | PersistencyEnvironment | env, |
| FileWriter | writer ) |
Write object to file writer.
Implements Dragengine.LoadSave.Persistable.
Reimplemented in Dragengine.Scenery.BAAAlignActor, Dragengine.Scenery.BAACutscene, and Dragengine.Scenery.BAAStateMachine.
References actor, actorAnimated, applyAnimations(), canHitCollider(), colliderChanged(), collisionResponse(), conversationWait(), locomotion, log(), loggingPrefix(), persistencyFactoryName(), updateAICollider(), updateAnimator(), updateLocomotion(), and writeObjectToFile().
Referenced by writeObjectToFile().
|
protected |
Actor the action is assigned to or null.
Referenced by Dragengine.Scenery.BAAAlignActor.activate(), Dragengine.Scenery.BAAVehicle.canHitCollider(), Dragengine.Scenery.BAAFirstPerson.colliderChanged(), getLocomotion(), getPlayerControllable(), Dragengine.Scenery.BAAStateMachine.initBehaviors(), Dragengine.Scenery.BAACutscene.persistencyFactoryName(), Dragengine.Scenery.BAAFirstPersonVR.persistencyFactoryName(), playerTakesControl(), Dragengine.Scenery.BAAFirstPersonVR.playerUpdateLocomotion(), think(), updateAnimator(), Dragengine.Scenery.BAAAlignActor.writeObjectToFile(), Dragengine.Scenery.BAACutscene.writeObjectToFile(), Dragengine.Scenery.BAAStateMachine.writeObjectToFile(), and writeObjectToFile().
|
protected |
Actor animated behavior if present.
Referenced by applyAnimations(), isActive(), playerReleasesControl(), updateAnimator(), and writeObjectToFile().
|
protected |
Behavior actor ai-action or null.
Referenced by activate(), activateWhileLoading(), applyAnimations(), initBehaviors(), isNotActive(), new(), updateAICollider(), updateLocomotion(), Dragengine.Scenery.BAACutscene.updateLocomotionPost(), and Dragengine.Scenery.BAAAlignActor.writeObjectToFile().
|
protected |
Conversation actor behavior if present.
Referenced by aiFinished(), applyAnimations(), isControlledByPlayer(), and updateAnimator().
|
protected |
Locomotion behavior.
Referenced by applyAnimations(), getAIAction(), Dragengine.Scenery.BAAAlignActor.initBehaviors(), Dragengine.Scenery.BAACutscene.initBehaviors(), Dragengine.Scenery.BAAFirstPerson.persistencyFactoryName(), Dragengine.Scenery.BAAFirstPersonVR.persistencyFactoryName(), Dragengine.Scenery.BAAVehicle.persistencyFactoryName(), updateAnimator(), Dragengine.Scenery.BAACutscene.writeObjectToFile(), and writeObjectToFile().
|
protected |
Behavior player controllable or null.
Referenced by applyAnimations(), and isNotActive().