Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
BehaviorTreeAdapter.h
Go to the documentation of this file.
1#pragma once
2
3#include "../AI/BTGraphLayoutEngine.h"
4#include "../AI/BehaviorTree.h"
5#include <vector>
6
7namespace Olympe
8{
9 namespace NodeGraphShared
10 {
12 {
13 public:
16
17 inline std::vector<BTNodeLayout> ComputeLayout(float nodeSpacingX, float nodeSpacingY, float zoomFactor)
18 {
19 if (!m_tree || !m_layoutEngine)
20 return std::vector<BTNodeLayout>();
21 return m_layoutEngine->ComputeLayout(m_tree, nodeSpacingX, nodeSpacingY, zoomFactor);
22 }
23
24 inline bool UpdateNodePosition(uint32_t nodeId, float x, float y)
25 {
26 if (!m_layoutEngine) return false;
27 return m_layoutEngine->UpdateNodePosition(nodeId, x, y);
28 }
29
30 inline const BTNodeLayout* GetNodeLayout(uint32_t nodeId) const
31 {
32 if (!m_layoutEngine) return nullptr;
33 return m_layoutEngine->GetNodeLayout(nodeId);
34 }
35
36 private:
37 const ::BehaviorTreeAsset* m_tree;
39 };
40 }
41}
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Computes clean hierarchical layouts for behavior trees.
bool UpdateNodePosition(uint32_t nodeId, float x, float y)
Update the stored position for a node (e.g.
const BTNodeLayout * GetNodeLayout(uint32_t nodeId) const
Get computed layout for a specific node.
std::vector< BTNodeLayout > ComputeLayout(const BehaviorTreeAsset *tree, float nodeSpacingX=320.0f, float nodeSpacingY=180.0f, float zoomFactor=1.0f)
Compute layout for a behavior tree.
std::vector< BTNodeLayout > ComputeLayout(float nodeSpacingX, float nodeSpacingY, float zoomFactor)
BehaviorTreeAdapter(const ::BehaviorTreeAsset *tree, BTGraphLayoutEngine *layoutEngine)
bool UpdateNodePosition(uint32_t nodeId, float x, float y)
const BTNodeLayout * GetNodeLayout(uint32_t nodeId) const
< Provides AssetID and INVALID_ASSET_ID
Layout information for a single behavior tree node.