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;
|
|
|
|
|
2018-01-09 21:59:05 +01:00
|
|
|
Goblin::Goblin(vec2i pos) : Actor(pos) {
|
2017-09-24 00:15:28 +02:00
|
|
|
name = "Goblin";
|
2017-09-17 13:43:13 +02:00
|
|
|
alive = true;
|
|
|
|
health = 4;
|
2017-09-26 15:49:11 +02:00
|
|
|
health_max = 4;
|
2017-09-17 13:43:13 +02:00
|
|
|
strength = 1;
|
2017-09-26 15:49:11 +02:00
|
|
|
sprite_id = 'g';
|
2017-10-18 12:22:28 +02:00
|
|
|
faction = FACTION_GOBS;
|
|
|
|
sprite_color = Color(.1f, .7f, .2f, 1);
|
2017-09-26 15:49:11 +02:00
|
|
|
|
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;
|