1 #ifndef CORE_SYSTEMS_TRAINERS_HPP
2 #define CORE_SYSTEMS_TRAINERS_HPP
4 #include <BLIB/Audio/AudioSystem.hpp>
5 #include <BLIB/ECS.hpp>
6 #include <BLIB/Engine/System.hpp>
7 #include <BLIB/Events.hpp>
8 #include <BLIB/Resources.hpp>
9 #include <BLIB/Tilemap/Position.hpp>
15 #include <SFML/Graphics.hpp>
29 :
public bl::engine::System
30 , bl::event::Listener<event::GameSaveInitializing,
31 bl::ecs::event::ComponentAdded<component::Trainer>, event::BattleCompleted,
32 event::EntityMoveFinished, event::EntityRotated> {
74 enum struct State { Searching, PoppingUp, Holding, Rising, Walking, Battling };
77 bl::ecs::ComponentPool<component::Trainer>& trainerPool;
78 bl::rc::res::TextureRef exclaimTxtr;
79 bl::gfx::Sprite exclaim;
80 bl::audio::AudioSystem::Handle exclaimSound;
84 bl::ecs::Entity walkingTrainer;
86 const bl::tmap::Position* trainerPos;
89 std::unordered_set<std::string> defeated;
91 virtual void update(std::mutex& stageMutex,
float dt,
float realDt,
float residual,
92 float realResidual)
override;
93 virtual void init(bl::engine::Engine&)
override;
96 virtual void observe(
const bl::ecs::event::ComponentAdded<component::Trainer>& tc)
override;
Core classes and functionality for both the editor and game.
Adding this component to an entity will allow it to move.
Adding this to an entity will make it a trainer that can battle.
Fired when a battle finishes.
Fired when an entity completes a move from one tile to another.
Fired when an entity rotates without moving.
Fired when the game is saving or loading. Allows systems to hook in their data.
Owns all primary systems and a reference to the engine.
This system manages trainers. It handles their vision and makes them walk up to the player.
virtual ~Trainers()=default
Destroys the system.
void resetDefeated()
Resets the list of defeated trainers.
bl::ecs::Entity approachingTrainer() const
Returns the trainer currently approaching the player.
bool trainerDefeated(const component::Trainer &trainer) const
Checks whether or not the given trainer has been defeated.
void setDefeated(component::Trainer &trainer)
Sets the given trainer as having been defeated and updates the game save data.
Trainers(Systems &owner)
Construct a new Trainers system.