dungeon/src/Goblin.cpp

29 lines
617 B
C++
Raw Normal View History

2017-09-17 13:43:13 +02:00
#include "Goblin.h"
#include "BehaviourTree.h"
#include "BehaviourTreeSelector.h"
#include "AttackEnemyNode.h"
#include "WanderNode.h"
#include "RestNode.h"
2017-09-23 22:06:36 +02:00
BehaviourTree* gobtree = nullptr;
2017-09-17 13:43:13 +02:00
Goblin::Goblin(Tilemap* map, vec2i pos) : Actor(map, pos) {
alive = true;
health = 4;
maxhealth = 4;
strength = 1;
2017-09-23 22:06:36 +02:00
if (gobtree == nullptr) {
auto * root = new BehaviourTreeSelector(nullptr);
gobtree = new BehaviourTree(root);
{
new AttackEnemyNode(root);
new RestNode(root);
new WanderNode(root);
}
2017-09-17 13:43:13 +02:00
}
2017-09-23 22:06:36 +02:00
bt = gobtree;
2017-09-17 13:43:13 +02:00
}
2017-09-23 22:06:36 +02:00
Goblin::~Goblin() = default;