Think class
Class for representing the brain of a game entity.
@author {@link https://github.com/Mugen87|Mugen87}
- Inheritance
-
- Object
- Goal
- CompositeGoal
- Think
Constructors
- Think([GameEntity? owner])
- Constructs a new Think object.
Properties
- active → bool
-
Returns true if the status of this goal is ACTIVE.
no setterinherited
- completed → bool
-
Returns true if the status of this goal is COMPLETED.
no setterinherited
-
evaluators
→ List<
GoalEvaluator> -
final
- failed → bool
-
Returns true if the status of this goal is FAILED.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- inactive → bool
-
Returns true if the status of this goal is INACTIVE.
no setterinherited
- owner ↔ GameEntity?
-
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status ↔ GoalStatus
-
getter/setter pairinherited
-
subgoals
→ List<
Goal> -
finalinherited
Methods
-
activate(
) → void -
Executed when this goal is activated.
override
-
activateIfInactive(
) → Goal -
Ensures the goal is activated if it is inactive.
inherited
-
addEvaluator(
GoalEvaluator evaluator) → Think - Adds the given goal evaluator to this instance.
-
addSubgoal(
Goal goal) → Goal -
Adds a goal as a subgoal to this instance.
inherited
-
arbitrate(
) → Think - This method represents the top level decision process of an agent. It iterates through each goal evaluator and selects the one that has the highest score as the current goal.
-
clearSubgoals(
) → Goal -
Removes all subgoals and ensures {@link Goal#terminate} is called
for each subgoal.
inherited
-
currentSubgoal(
) → Goal? -
Returns the current subgoal. If no subgoals are defined, null is returned.
inherited
-
execute(
) → void -
Executed in each simulation step.
override
-
executeSubgoals(
) → GoalStatus -
Executes the current subgoal of this composite goal.
inherited
-
fromJSON(
Map< String, dynamic> json) → Think -
Restores this instance from the given JSON object.
override
-
handleMessage(
Telegram telegram) → bool -
Returns true if the given message was processed by the current subgoal.
inherited
-
hasSubgoals(
) → bool -
Returns true if this composite goal has subgoals.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerType(
String type, Function constructor) → Think - Registers a custom type for deserialization. When calling {@link Think#fromJSON} this instance is able to pick the correct constructor in order to create custom goals or goal evaluators.
-
removeEvaluator(
GoalEvaluator evaluator) → Think - Removes the given goal evaluator from this instance.
-
removeSubgoal(
Goal goal) → Goal -
Removes a subgoal from this instance.
inherited
-
replanIfFailed(
) → Goal -
Ensures the goal is replanned if it has failed.
inherited
-
resolveReferences(
Map< String, GameEntity> entities) → CompositeGoal -
Restores UUIDs with references to GameEntity objects.
inherited
-
terminate(
) → void -
Executed when this goal is satisfied.
override
-
toJSON(
) → Map< String, dynamic> -
Transforms this instance into a JSON object.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited