Spaces:
Runtime error
Runtime error
File size: 1,389 Bytes
00437a9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
namespace Quantum
{
public static unsafe partial class AIParamExtensions
{
public static T ResolveFromHFSM<T>(this AIParam<T> aiParam, Frame frame, EntityRef entity)
{
var aiConfigRef = aiParam.Source == AIParamSource.Config
? frame.Unsafe.GetPointer<HFSMAgent>(entity)->Config
: default;
return aiParam.Resolve(frame, entity, aiConfigRef);
}
public static T ResolveFromGOAP<T>(this AIParam<T> aiParam, Frame frame, EntityRef entity)
{
var aiConfigRef = aiParam.Source == AIParamSource.Config
? frame.Unsafe.GetPointer<GOAPAgent>(entity)->Config
: default;
return aiParam.Resolve(frame, entity, aiConfigRef);
}
public static T ResolveFromBT<T>(this AIParam<T> aiParam, Frame frame, EntityRef entity)
{
var aiConfigRef = aiParam.Source == AIParamSource.Config
? frame.Unsafe.GetPointer<BTAgent>(entity)->Config
: default;
return aiParam.Resolve(frame, entity, aiConfigRef);
}
public static T Resolve<T>(this AIParam<T> aiParam, Frame frame, EntityRef entity, AssetRefAIConfig aiConfigRef)
{
var blackboard = aiParam.Source == AIParamSource.Blackboard
? frame.Unsafe.GetPointer<AIBlackboardComponent>(entity)
: null;
var aiConfig = aiParam.Source == AIParamSource.Config
? frame.FindAsset<AIConfig>(aiConfigRef.Id)
: null;
return aiParam.Resolve(frame, entity, blackboard, aiConfig);
}
}
} |