Refactored boss fight to pull out the FSM code into boss::Fight.
This commit is contained in:
parent
3b11ed0a75
commit
61a40ae7cd
11 changed files with 127 additions and 94 deletions
36
boss/fight.hpp
Normal file
36
boss/fight.hpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
#include "simplefsm.hpp"
|
||||
#include "dinkyecs.hpp"
|
||||
#include "boss/ui.hpp"
|
||||
#include "gui/fsm_events.hpp"
|
||||
#include <memory>
|
||||
#include <any>
|
||||
|
||||
namespace boss {
|
||||
using std::shared_ptr;
|
||||
|
||||
enum class State {
|
||||
START=0,
|
||||
END=1
|
||||
};
|
||||
|
||||
class Fight : public DeadSimpleFSM<State, gui::Event> {
|
||||
public:
|
||||
shared_ptr<World> $world = nullptr;
|
||||
DinkyECS::Entity $boss_id = NONE;
|
||||
boss::UI $ui;
|
||||
sf::Vector2f mouse_pos{0,0};
|
||||
|
||||
Fight(shared_ptr<World> world, DinkyECS::Entity boss_id);
|
||||
|
||||
bool event(gui::Event ev, std::any data);
|
||||
|
||||
void START(gui::Event ev, std::any data);
|
||||
void END(gui::Event ev, std::any data);
|
||||
|
||||
void render(sf::RenderWindow& window) {
|
||||
$ui.render(window);
|
||||
}
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue