-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonsterController.cpp
More file actions
28 lines (25 loc) · 864 Bytes
/
MonsterController.cpp
File metadata and controls
28 lines (25 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// MonsterController.cpp
#include "MonsterController.hpp"
#include "MonsterBehaviorFactory.hpp"
MonsterController::MonsterController(
const std::vector<Node>& graph,
const std::vector<sf::RectangleShape>& walls,
Kinematic& monster,
Kinematic& player,
const sf::Vector2f& monStart,
const sf::Vector2f& plyStart,
float eatRadius)
{
world_.monster = &monster;
world_.player = &player;
world_.graphNodes = &graph;
world_.walls = &walls;
world_.eatRadius = eatRadius;
world_.lastAction = "";
root_ = MonsterBehaviorFactory::buildTree(
monStart, plyStart, eatRadius
);
}
void MonsterController::update(float dt) {
root_->tick(world_, dt);
}