From 3957dfb9361e864f6362e59655c885f52b39371f Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 6 May 2022 18:23:42 +0200 Subject: docs: add tagging to basic example --- examples/basic/src/basic_example.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'examples/basic/src/basic_example.cpp') 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 @@ -12,14 +12,24 @@ int main() std::cout << "Created a hero\n"; - auto enemy_factory = container.get(); + auto enemy_creator = container.get(); - 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"; } -- cgit v1.2.3-18-g5258