implement scrap and ship skeleton
This commit is contained in:
31
src/lib/sim/ShipSystem.h
Normal file
31
src/lib/sim/ShipSystem.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include <QVector2D>
|
||||
|
||||
#include "EntityId.h"
|
||||
#include "GameConfig.h"
|
||||
#include "Ship.h"
|
||||
|
||||
class ShipSystem
|
||||
{
|
||||
public:
|
||||
ShipSystem(const GameConfig& config,
|
||||
std::function<EntityId()> allocateId);
|
||||
|
||||
EntityId spawn(const std::string& blueprintId, int level, QVector2D position);
|
||||
void despawn(EntityId id);
|
||||
|
||||
const Ship* findShip(EntityId id) const;
|
||||
std::vector<Ship> allShips() const;
|
||||
void forEach(std::function<void(Ship&)> fn);
|
||||
|
||||
private:
|
||||
const ShipDef* findShipDef(const std::string& blueprintId) const;
|
||||
|
||||
const GameConfig& m_config;
|
||||
std::function<EntityId()> m_allocateId;
|
||||
std::vector<Ship> m_ships;
|
||||
};
|
||||
Reference in New Issue
Block a user