diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-06 18:23:42 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-05-06 18:23:55 +0200 |
commit | 3957dfb9361e864f6362e59655c885f52b39371f (patch) | |
tree | 5ef55a5eb418664b4a5c0d2d9328ff4ca99a74a7 /examples/basic/src/basic_example.cpp | |
parent | d8ea3721d83254e91c5617d83f2aac5a897107fb (diff) |
docs: add tagging to basic examplev0.1.3
Diffstat (limited to 'examples/basic/src/basic_example.cpp')
-rw-r--r-- | examples/basic/src/basic_example.cpp | 24 |
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"; } |