diff --git a/src/include/Activities/FightActivity.hpp b/src/include/Activities/FightActivity.hpp index 047b375..80abfed 100644 --- a/src/include/Activities/FightActivity.hpp +++ b/src/include/Activities/FightActivity.hpp @@ -24,7 +24,7 @@ class FightActivity: public Activity { ~FightActivity(); ActivityEnum executeActivity() override; - void runCurrentState(Game &game); + void runCurrentState(); private: /* @@ -37,10 +37,6 @@ class FightActivity: public Activity { std::unique_ptr currentFightState; Enemy initEnemy(); - void runPlayersTurn(); - void runEnemiesTurn(); - void runDefeat(); - void runVictory(); }; #endif \ No newline at end of file diff --git a/src/include/UIElements/UIStats.hpp b/src/include/UIElements/UIStats.hpp index 1c6eb47..0645aed 100644 --- a/src/include/UIElements/UIStats.hpp +++ b/src/include/UIElements/UIStats.hpp @@ -17,7 +17,7 @@ class UIStats: public UIElement, Observer { sf::Vector2f getPosition() override; void setPosition(float x, float y) override; sf::FloatRect getSize() override; - + void update(Actor newActor) override; private: diff --git a/src/main/Activities/FightActivity.cpp b/src/main/Activities/FightActivity.cpp index ea0421f..502936f 100644 --- a/src/main/Activities/FightActivity.cpp +++ b/src/main/Activities/FightActivity.cpp @@ -42,7 +42,7 @@ FightActivity::~FightActivity() { this->fightEnv.backgroundMusic.stop(); } -void FightActivity::runCurrentState(Game &game) { +void FightActivity::runCurrentState() { FightStateEnum newStateFightEnum = this->currentFightState->run(this->fightEnv); if (newStateFightEnum != this->currentFightStateEnum) { switch (newStateFightEnum) { @@ -50,6 +50,7 @@ void FightActivity::runCurrentState(Game &game) { this->currentFightState = std::move(std::make_unique(this->fightEnv)); break; case FightStateEnum::ENEMY_STATE: + std::cout << "Player health: " << Game::getInstance().player.health << std::endl; this->currentFightState = std::move(std::make_unique()); break; case FightStateEnum::TURN_CHANGE: @@ -73,7 +74,7 @@ ActivityEnum FightActivity::executeActivity() { this->exitButton.draw(); this->fightEnv.textFadingManager.run(); - this->runCurrentState(game); + this->runCurrentState(); if (this->exitButton.clickListener()) { diff --git a/src/main/UIElements/UIStats.cpp b/src/main/UIElements/UIStats.cpp index 6fd32ef..56b47fc 100644 --- a/src/main/UIElements/UIStats.cpp +++ b/src/main/UIElements/UIStats.cpp @@ -3,9 +3,12 @@ UIStats::~UIStats() { } + UIStats::UIStats(std::shared_ptr actor): Observer(reinterpret_cast &>(*actor)) { + Game& game = Game::getInstance(); sf::Vector2u windowSize = game.gameWindow.getSize(); + this->actor = _actor; sf::Color statsValueFontColor = sf::Color::Yellow; sf::Color statsLabelFontColor = sf::Color::White; this->statsTextHeight = windowSize.y * 0.015;