blob: 2974c09b1511cf982178ab3db3779e70b8908ac9 (
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
28
29
30
31
32
33
34
35
|
#include "bootstrap.hpp"
#include "interfaces/enemy_creator.hpp"
#include "interfaces/hero.hpp"
#include <iostream>
auto main() -> int
{
auto container = bootstrap();
auto hero = container.get<IHero>();
std::cout << "Created a hero\n";
auto enemy_creator = container.get<IEnemyCreator>();
auto small_enemy = enemy_creator->create_small_enemy();
std::cout << "Created a small enemy with " << small_enemy->get_health()
<< " in health\n";
auto big_enemy = enemy_creator->create_big_enemy();
std::cout << "Created a big enemy with " << big_enemy->get_health() << " in health\n";
hero->fight(*small_enemy);
std::cout << "The hero hit the small enemy! The small enemy now has "
<< small_enemy->get_health() << " in health\n";
hero->fight(*big_enemy);
std::cout << "The hero hit the big enemy! The big enemy now has "
<< big_enemy->get_health() << " in health\n";
}
|