aboutsummaryrefslogtreecommitdiff
path: root/RedTileBehavior.cpp
blob: 0c0dff41377384f9e81421a4bc458ef49f7a052a (plain)
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
#include <memory>

#include "RedTileBehavior.h"
#include "BlueTileBehavior.h"
#include "Tile.h"
#include "Museum.h"

using namespace std;

RedTileBehavior RedTileBehavior::instance { RedTileBehavior::type };

void RedTileBehavior::step(Artist & artist) {
	this->interactions++;
	this->museum->people.remove_artist(artist);
}

void RedTileBehavior::update(Tile & tile) {
	if (this->interactions == 0) return;
	tile.set_type(BlueTileBehavior::type);
}

unique_ptr<TileBehaviorStrategy> RedTileBehavior::clone(Museum & museum) {
	auto instance = new RedTileBehavior();
	instance->museum = &museum;
	return unique_ptr<TileBehaviorStrategy>(instance);
}