-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.hpp
56 lines (46 loc) · 1.54 KB
/
Player.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "Updator.hpp"
#ifndef PLAYER_HEADER_HPP
#define PLAYER_HEADER_HPP
namespace StrategyGoo
{
struct Squaddie : public Updator
{
using SquaddieRefrence = std::reference_wrapper< Squaddie >;
Squaddie( entt::registry& registry_, BoardPosition start, GameBoard* board_,
size_t tileWidth, size_t tileHeight );
void Update() override;
void TickOrder();
bool CheckSelect( entt::registry& registry, sf::RenderWindow& window );
float GetSpeed();
void SetSpeed( float speed_ );
static std::pair< bool, std::optional< entt::entity > > SelectSquaddie( entt::registry& registry, sf::RenderWindow& window );
static bool AddOrders( entt::registry& registry, entt::entity& id, sf::View& camera );
static bool ExecuteOrders( entt::registry& registry );
Squaddie& ObtainThis();
bool active = true;
protected:
float speed = 1.f;
};
struct PlayerOrder {
virtual bool Tick( Squaddie& squaddie, entt::registry& registry ) = 0;
};
struct MoveOrder : public PlayerOrder
{
BoardPosition from, to;
MoveOrder( BoardPosition from_, BoardPosition to_ );
bool Tick( Squaddie& squaddie, entt::registry& registry ) override;
};
struct ShootGrenadeOrder : public PlayerOrder
{
ShootGrenadeOrder( BoardPosition from_, BoardPosition to_ );
bool Tick( Squaddie& squaddie, entt::registry& registry ) override;
bool createdGrenade = false;
bool detonatedGrenade = false;
BoardPosition from, to;
size_t explosionTime = 0;
size_t maxExplosionTime = 5;
bool killedGoo = false;
entt::entity grenadeID, explosionID;
};
}
#endif