|
Drag[en]gine Script Module DragonScript 1.35
|
Base actor action using state machine. 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 | 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 | 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. | |
| ECBehaviorStateMachine.Instance | getBehaviorStateMachine () |
| State machine behavior. | |
| SMContext | getContext () |
| State machine context. | |
| StateMachine | getStateMachine () |
| State machine. | |
| void | leftGameWorld () |
| Actor left game world. | |
| BAAStateMachine | new () |
| Create actor action. | |
| BAAStateMachine | new (PersistencyEnvironment env, FileReader reader) |
| Create actor ai restoring from file reader. | |
| BAAStateMachine | new (StateMachine stateMachine) |
| Create actor ai using state machine. | |
| 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 | sendInputAsEvent (String event, Object parameter) |
| Send input as event to state machine. | |
| void | setBehaviorStateMachine (ECBehaviorStateMachine.Instance behavior) |
| Set behavior behavior. | |
| void | setContext (SMContext context) |
| Set state machine context. | |
| void | setStateMachine (StateMachine stateMachine) |
| Set state machine to use or null. | |
| void | think (float elapsed) |
| Thinking. | |
| void | writeObjectToFile (PersistencyEnvironment env, FileWriter writer) |
| Write object to file writer. | |
| Public Member Functions inherited from Dragengine.Scenery.BaseActorAction | |
| void | aiFailed () |
| Notify actor AI this action failed. | |
| void | aiFinished () |
| Notify actor AI this action failed. | |
| void | deactivate () |
| Action has been unset as active action in an actor. | |
| 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 | 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. | |
Public Attributes | |
| ECBehaviorStateMachine.Instance | pBehaviorStateMachine |
| SMContext | pContext |
| String | pLoadStateId |
| StateMachine | pStateMachine |
Protected Member Functions | |
| void | initBehaviors () |
| Init behaviors. | |
| Protected Member Functions inherited from Dragengine.Scenery.BaseActorAction | |
| void | applyAnimations () |
| Apply animations. | |
| void | initAnimator () |
| Initialize animator. | |
| void | updateAICollider (float elapsed) |
| Update AI collider. | |
| void | updateAnimator (float elapsed) |
| Update animator controllers. | |
| void | updateLocomotion (float elapsed) |
| Update locomotion. | |
Protected Attributes | |
| bool | moveIfColliderChanged |
| Property update actor geometry on collider changed. | |
| Protected Attributes inherited from Dragengine.Scenery.BaseActorAction | |
| 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 using state machine.
This class adds support to send state machine events for inputs for these interfaces:
Otherwise the state machine is responsible for the entire action handling. Helper behaviors provide common actions and conditions to simplify this task.
The following events can be send to the state machine:
Input events are send to state machine using interface BAAStateMachineEvent. For further information see the respective bridge classes:
| void Dragengine.Scenery.BAAStateMachine.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 from Dragengine.Scenery.BaseActorAction.
Referenced by initBehaviors().
| void Dragengine.Scenery.BAAStateMachine.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 from Dragengine.Scenery.BaseActorAction.
References getBehaviorStateMachine().
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.cancel | ( | ) |
Cancel action the next time possible.
Calls aiFailed().
Reimplemented from Dragengine.Scenery.BaseActorAction.
Referenced by writeObjectToFile().
Two colliders can hit each other.
Reimplemented from Dragengine.Scenery.BaseActorAction.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.colliderChanged | ( | Collider | owner | ) |
Collider changed.
Reimplemented from Dragengine.Scenery.BaseActorAction.
References getContext(), and pContext.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.collisionResponse | ( | Collider | owner, |
| CollisionInfo | info ) |
Collision detected.
Reimplemented from Dragengine.Scenery.BaseActorAction.
References pStateMachine.
Referenced by writeObjectToFile().
| bool Dragengine.Scenery.BAAStateMachine.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 from Dragengine.Scenery.BaseActorAction.
References setStateMachine().
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.dispose | ( | ) |
Dispose of actor action.
Reimplemented from Dragengine.Scenery.BaseActorAction.
References new(), and pStateMachine.
Referenced by getContext(), and setContext().
| void Dragengine.Scenery.BAAStateMachine.enteredGameWorld | ( | ) |
Actor entered game world.
Reimplemented from Dragengine.Scenery.BaseActorAction.
References pBehaviorStateMachine.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.enterFrame | ( | ) |
Actor has been added to game world and enterFrame() is called once.
Reimplemented from Dragengine.Scenery.BaseActorAction.
References pBehaviorStateMachine, and setBehaviorStateMachine().
Referenced by writeObjectToFile().
| ECBehaviorStateMachine.Instance Dragengine.Scenery.BAAStateMachine.getBehaviorStateMachine | ( | ) |
State machine behavior.
Referenced by activateWhileLoading().
| SMContext Dragengine.Scenery.BAAStateMachine.getContext | ( | ) |
State machine context.
References dispose(), and pBehaviorStateMachine.
Referenced by colliderChanged(), and writeObjectToFile().
| StateMachine Dragengine.Scenery.BAAStateMachine.getStateMachine | ( | ) |
|
protected |
Init behaviors.
Retrieve and store required and optional behavior instances from the actor element.
Reimplemented from Dragengine.Scenery.BaseActorAction.
References activate(), Dragengine.Scenery.BaseActorAction.actor, initBehaviors(), pContext, pStateMachine, and setStateMachine().
Referenced by initBehaviors(), and writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.leftGameWorld | ( | ) |
Actor left game world.
Reimplemented from Dragengine.Scenery.BaseActorAction.
Referenced by writeObjectToFile().
| BAAStateMachine Dragengine.Scenery.BAAStateMachine.new | ( | ) |
Create actor action.
Reimplemented from Dragengine.Scenery.BaseActorAction.
References moveIfColliderChanged.
Referenced by dispose(), new(), setBehaviorStateMachine(), and setStateMachine().
| BAAStateMachine Dragengine.Scenery.BAAStateMachine.new | ( | PersistencyEnvironment | env, |
| FileReader | reader ) |
Create actor ai restoring from file reader.
Reimplemented from Dragengine.Scenery.BaseActorAction.
| BAAStateMachine Dragengine.Scenery.BAAStateMachine.new | ( | StateMachine | stateMachine | ) |
| String Dragengine.Scenery.BAAStateMachine.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.
Reimplemented from Dragengine.Scenery.BaseActorAction.
References pContext.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.playerPostThink | ( | float | elapsed | ) |
Post physics for player controlled actor only.
Default implementation does nothing.
Reimplemented from Dragengine.Scenery.BaseActorAction.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.playerReleasesControl | ( | ) |
Player released control of actor.
Reimplemented from Dragengine.Scenery.BaseActorAction.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.playerTakesControl | ( | ) |
Player takes control of actor.
Reimplemented from Dragengine.Scenery.BaseActorAction.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.playerThink | ( | float | elapsed | ) |
Thinking for player controlled actor only.
Default implementation does nothing.
Reimplemented from Dragengine.Scenery.BaseActorAction.
References getStateMachine(), and pStateMachine.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.postThink | ( | float | elapsed | ) |
Post physics.
Reimplemented from Dragengine.Scenery.BaseActorAction.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.sendInputAsEvent | ( | String | event, |
| Object | parameter ) |
Send input as event to state machine.
| event | Event to send. |
| parameter | Optional parameter or null. |
Implements Dragengine.Scenery.BAAStateMachineEvent.
References setContext().
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.setBehaviorStateMachine | ( | ECBehaviorStateMachine.Instance | behavior | ) |
| void Dragengine.Scenery.BAAStateMachine.setContext | ( | SMContext | context | ) |
| void Dragengine.Scenery.BAAStateMachine.setStateMachine | ( | StateMachine | stateMachine | ) |
Set state machine to use or null.
Change affects context only before activate() has been called.
References new().
Referenced by conversationWait(), initBehaviors(), and writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.think | ( | float | elapsed | ) |
Thinking.
Default implementation does these actions in this order:
playerThink() is called by ECBehaviorActorAIAction if player controls this actor.
Reimplemented from Dragengine.Scenery.BaseActorAction.
Referenced by writeObjectToFile().
| void Dragengine.Scenery.BAAStateMachine.writeObjectToFile | ( | PersistencyEnvironment | env, |
| FileWriter | writer ) |
Write object to file writer.
Reimplemented from Dragengine.Scenery.BaseActorAction.
References activateWhileLoading(), Dragengine.Scenery.BaseActorAction.actor, cancel(), canHitCollider(), colliderChanged(), collisionResponse(), conversationWait(), enteredGameWorld(), enterFrame(), getContext(), initBehaviors(), Dragengine.Scenery.BaseActorAction.isActive(), leftGameWorld(), moveIfColliderChanged, pBehaviorStateMachine, pContext, persistencyFactoryName(), playerPostThink(), playerReleasesControl(), playerTakesControl(), playerThink(), pLoadStateId, postThink(), pStateMachine, sendInputAsEvent(), setStateMachine(), think(), and writeObjectToFile().
Referenced by writeObjectToFile().
|
protected |
Property update actor geometry on collider changed.
For performance reasons updating the actor geometry not done during colliderChanged() but during postThink() when project to ground has been done. Between postThink() and the next elementThink() actor geometry has to be updated or the actor element matrix is out of sync when AI operates on it. This parameter is used to keep track of
Referenced by new(), new(), and writeObjectToFile().
| ECBehaviorStateMachine.Instance Dragengine.Scenery.BAAStateMachine.pBehaviorStateMachine |
Referenced by enteredGameWorld(), enterFrame(), getContext(), and writeObjectToFile().
| SMContext Dragengine.Scenery.BAAStateMachine.pContext |
Referenced by colliderChanged(), initBehaviors(), persistencyFactoryName(), setContext(), and writeObjectToFile().
| String Dragengine.Scenery.BAAStateMachine.pLoadStateId |
Referenced by getStateMachine(), and writeObjectToFile().
| StateMachine Dragengine.Scenery.BAAStateMachine.pStateMachine |
Referenced by collisionResponse(), dispose(), getStateMachine(), initBehaviors(), playerThink(), and writeObjectToFile().