aboutsummaryrefslogtreecommitdiff
path: root/examples/basic/src/basic_example.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/basic/src/basic_example.cpp')
-rw-r--r--examples/basic/src/basic_example.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/examples/basic/src/basic_example.cpp b/examples/basic/src/basic_example.cpp
index 6f3e15c..e91235f 100644
--- a/examples/basic/src/basic_example.cpp
+++ b/examples/basic/src/basic_example.cpp
@@ -1,5 +1,5 @@
#include "bootstrap.hpp"
-#include "interfaces/enemy.hpp"
+#include "interfaces/enemy_creator.hpp"
#include "interfaces/hero.hpp"
#include <iostream>
@@ -12,14 +12,24 @@ int main()
std::cout << "Created a hero\n";
- auto enemy_factory = container.get<IEnemyFactory>();
+ auto enemy_creator = container.get<IEnemyCreator>();
- auto enemy = enemy_factory();
+ auto small_enemy = enemy_creator->create_small_enemy();
- std::cout << "Created a enemy with " << enemy->get_health() << " in health\n";
+ std::cout << "Created a small enemy with " << small_enemy->get_health()
+ << " in health\n";
- hero->fight(*enemy);
+ auto big_enemy = enemy_creator->create_big_enemy();
- std::cout << "The hero hit the enemy! The enemy now has " << enemy->get_health()
- << " in health\n";
+ 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";
}