Merge branch 'Tryibion-blackboard-utils'
This commit is contained in:
@@ -57,6 +57,15 @@ public:
|
||||
{
|
||||
return &_knowledge;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blackboard of a given type.
|
||||
/// </summary>
|
||||
template<typename T>
|
||||
FORCE_INLINE T* GetBlackboard()
|
||||
{
|
||||
return _knowledge.GetBlackboard<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last behavior tree execution result.
|
||||
|
||||
@@ -124,6 +124,18 @@ public:
|
||||
RemoveGoal(T::TypeInitializer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blackboard of a given type.
|
||||
/// </summary>
|
||||
template<typename T>
|
||||
FORCE_INLINE T* GetBlackboard()
|
||||
{
|
||||
auto* structure = Blackboard.AsStructure<T>();
|
||||
if (structure)
|
||||
return structure;
|
||||
return Cast<T>((ScriptingObject*)Blackboard);
|
||||
}
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Compares two values and returns the comparision result.
|
||||
|
||||
@@ -11,6 +11,18 @@ using FlaxEngine.GUI;
|
||||
|
||||
namespace FlaxEngine
|
||||
{
|
||||
partial class Behavior
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the blackboard of the given type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"> The blackboard type.</typeparam>
|
||||
public T GetBlackboard<T>()
|
||||
{
|
||||
return Knowledge.GetBlackboard<T>();
|
||||
}
|
||||
}
|
||||
|
||||
partial class BehaviorKnowledge
|
||||
{
|
||||
/// <summary>
|
||||
@@ -33,6 +45,16 @@ namespace FlaxEngine
|
||||
{
|
||||
RemoveGoal(typeof(T));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blackboard of the given type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"> The blackboard type.</typeparam>
|
||||
[Unmanaged]
|
||||
public T GetBlackboard<T>()
|
||||
{
|
||||
return (T)Blackboard;
|
||||
}
|
||||
}
|
||||
|
||||
partial class BehaviorTreeRootNode
|
||||
|
||||
Reference in New Issue
Block a user