MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / AccessBehaviorKnowledge

Function AccessBehaviorKnowledge

Source/Engine/AI/BehaviorKnowledge.cpp:95–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95bool AccessBehaviorKnowledge(BehaviorKnowledge* knowledge, const StringAnsiView& path, Variant& value, bool set)
96{
97 const int32 typeEnd = path.Find('/');
98 if (typeEnd == -1)
99 return false;
100 const StringAnsiView type(path.Get(), typeEnd);
101 if (type == "Blackboard")
102 {
103 const StringAnsiView member(path.Get() + typeEnd + 1, path.Length() - typeEnd - 1);
104 return AccessVariant(knowledge->Blackboard, member, value, set);
105 }
106 if (type == "Goal")
107 {
108 const StringAnsiView subPath(path.Get() + typeEnd + 1, path.Length() - typeEnd - 1);
109 const int32 goalTypeEnd = subPath.Find('/');
110 const StringAnsiView goalType(subPath.Get(), goalTypeEnd);
111 const StringAnsiView member(subPath.Get() + goalTypeEnd + 1, subPath.Length() - goalTypeEnd - 1);
112 for (Variant& goal : knowledge->Goals)
113 {
114 if (goalType == goal.Type.GetTypeName())
115 {
116 return AccessVariant(goal, member, value, set);
117 }
118 }
119 }
120 return false;
121}
122
123bool BehaviorKnowledgeSelectorAny::Set(BehaviorKnowledge* knowledge, const Variant& value) const
124{

Callers 2

GetMethod · 0.85
SetMethod · 0.85

Calls 5

AccessVariantFunction · 0.85
FindMethod · 0.45
GetMethod · 0.45
LengthMethod · 0.45
GetTypeNameMethod · 0.45

Tested by

no test coverage detected