NoJobEngine
2.0.7
Toggle main menu visibility
Loading...
Searching...
No Matches
BTInstance.h
Go to the documentation of this file.
1
6
#pragma once
7
#include "
BTTree.h
"
8
#include <memory>
9
#include <stdexcept>
10
11
namespace
NoJob
{
12
class
BTInstance
{
13
public
:
14
explicit
BTInstance
(std::shared_ptr<const BTTree> tree) : m_Tree(std::move(tree)) {
15
if
(!m_Tree)
throw
std::invalid_argument(
"BTInstance requires a tree"
);
16
}
17
BTStatus
Tick
(
float
dt) { m_Context.BeginTick();
return
m_Tree->Root().Tick(m_Context, dt); }
18
void
Reset
() { m_Tree->Root().Reset(m_Context); m_Context.Reset(); }
19
const
BTTree
&
Tree
()
const
{
return
*m_Tree; }
20
BTContext
&
Context
() {
return
m_Context; }
21
const
BTContext
&
Context
()
const
{
return
m_Context; }
22
private
:
23
std::shared_ptr<const BTTree> m_Tree;
24
BTContext
m_Context;
25
};
26
}
BTTree.h
Behavior tree ownership and evaluation.
NoJob::BTContext
Definition
BTContext.h:24
NoJob::BTInstance::Reset
void Reset()
Definition
BTInstance.h:18
NoJob::BTInstance::Context
BTContext & Context()
Definition
BTInstance.h:20
NoJob::BTInstance::BTInstance
BTInstance(std::shared_ptr< const BTTree > tree)
Definition
BTInstance.h:14
NoJob::BTInstance::Context
const BTContext & Context() const
Definition
BTInstance.h:21
NoJob::BTInstance::Tick
BTStatus Tick(float dt)
Definition
BTInstance.h:17
NoJob::BTInstance::Tree
const BTTree & Tree() const
Definition
BTInstance.h:19
NoJob::BTTree
Definition
BTTree.h:14
NoJob
Definition
BTActionNode.h:13
NoJob::BTStatus
BTStatus
Result of a behavior tree node tick.
Definition
BTNode.h:13
Engine
AI
BehaviorTree
BTInstance.h
Generated by
1.18.0