Add Behavior knowledge data debugging
This commit is contained in:
@@ -203,6 +203,17 @@ bool BehaviorKnowledge::HasGoal(ScriptingTypeHandle type) const
|
||||
return false;
|
||||
}
|
||||
|
||||
Variant BehaviorKnowledge::GetGoal(ScriptingTypeHandle type)
|
||||
{
|
||||
for (const Variant& goal : Goals)
|
||||
{
|
||||
const ScriptingTypeHandle goalType = Scripting::FindScriptingType(goal.Type.GetTypeName());
|
||||
if (goalType == type)
|
||||
return goal;
|
||||
}
|
||||
return Variant::Null;
|
||||
}
|
||||
|
||||
void BehaviorKnowledge::AddGoal(Variant&& goal)
|
||||
{
|
||||
int32 i = 0;
|
||||
|
||||
@@ -47,7 +47,7 @@ API_CLASS() class FLAXENGINE_API BehaviorKnowledge : public ScriptingObject
|
||||
/// <summary>
|
||||
/// List of all active goals of the behaviour (structure or class).
|
||||
/// </summary>
|
||||
Array<Variant> Goals;
|
||||
API_FIELD() Array<Variant> Goals;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
@@ -96,6 +96,13 @@ public:
|
||||
return HasGoal(T::TypeInitializer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the goal from the knowledge.
|
||||
/// </summary>
|
||||
/// <param name="type">The goal type.</param>
|
||||
/// <returns>The goal value or null if not found.</returns>
|
||||
API_FUNCTION() Variant GetGoal(ScriptingTypeHandle type);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the goal to the knowledge. If goal of that type already exists then it's value is updated.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user