Merge branch 'Tryibion-blackboard-utils'
This commit is contained in:
@@ -57,6 +57,15 @@ public:
|
|||||||
{
|
{
|
||||||
return &_knowledge;
|
return &_knowledge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the blackboard of a given type.
|
||||||
|
/// </summary>
|
||||||
|
template<typename T>
|
||||||
|
FORCE_INLINE T* GetBlackboard()
|
||||||
|
{
|
||||||
|
return _knowledge.GetBlackboard<T>();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the last behavior tree execution result.
|
/// Gets the last behavior tree execution result.
|
||||||
|
|||||||
@@ -124,6 +124,18 @@ public:
|
|||||||
RemoveGoal(T::TypeInitializer);
|
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:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares two values and returns the comparision result.
|
/// Compares two values and returns the comparision result.
|
||||||
|
|||||||
@@ -11,6 +11,18 @@ using FlaxEngine.GUI;
|
|||||||
|
|
||||||
namespace FlaxEngine
|
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
|
partial class BehaviorKnowledge
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -33,6 +45,16 @@ namespace FlaxEngine
|
|||||||
{
|
{
|
||||||
RemoveGoal(typeof(T));
|
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
|
partial class BehaviorTreeRootNode
|
||||||
|
|||||||
Reference in New Issue
Block a user