move ecs related code to own folder
This commit is contained in:
53
src/lib/ecs/system/CombatSystem.h
Normal file
53
src/lib/ecs/system/CombatSystem.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include <QVector2D>
|
||||
|
||||
#include "Building.h"
|
||||
#include "FactionComponent.h"
|
||||
#include "FireEvent.h"
|
||||
#include "GameConfig.h"
|
||||
#include "PositionComponent.h"
|
||||
#include "Tick.h"
|
||||
#include "WeaponComponent.h"
|
||||
|
||||
#include "entt/entity/entity.hpp"
|
||||
|
||||
class BuildingSystem;
|
||||
class EntityAdmin;
|
||||
|
||||
class CombatSystem
|
||||
{
|
||||
public:
|
||||
explicit CombatSystem(const GameConfig& config);
|
||||
|
||||
void tick(Tick currentTick,
|
||||
EntityAdmin& admin,
|
||||
BuildingSystem& buildings,
|
||||
std::vector<FireEvent>& outFireEvents);
|
||||
|
||||
void applyPendingDamage(Tick currentTick, EntityAdmin& admin);
|
||||
|
||||
private:
|
||||
struct PendingDamage
|
||||
{
|
||||
entt::entity target;
|
||||
float amount;
|
||||
Tick appliesAt;
|
||||
};
|
||||
|
||||
std::vector<PendingDamage> m_pendingDamage;
|
||||
|
||||
void resolveWeapon(
|
||||
entt::entity shipEntity,
|
||||
WeaponComponent& weapon,
|
||||
const PositionComponent& ownPos,
|
||||
const FactionComponent& ownFaction,
|
||||
Tick currentTick,
|
||||
EntityAdmin& admin,
|
||||
std::vector<FireEvent>& out);
|
||||
|
||||
const GameConfig& m_config;
|
||||
};
|
||||
Reference in New Issue
Block a user