This commit is contained in:
bart
2026-11-08 17:06:47 +01:00
parent 17901ce25c
commit 408541c7e0
46 changed files with 1474 additions and 1057 deletions
+14 -1
View File
@@ -12,7 +12,8 @@
enum class UnitState {
Idle,
Moving,
Attacking
Attacking,
Building
};
class Unit {
@@ -27,6 +28,7 @@ public:
QVector3D worldPos;
float health;
float maxHealth;
int buildCharges;
UnitState state;
// Movement Path
@@ -39,15 +41,26 @@ public:
// Attack cooldown / flash
float attackFlashTimer;
// Building State
float buildProgress; // 0.0 to 1.0
float buildDuration;
QString buildingImprovementId;
void update(float deltaTime, float tickDuration, float simSpeedMultiplier,
Matrix2D<TerrainPoint> *mapPoints, int numPoints05);
void setPath(const std::vector<std::pair<int, int>> &newPath);
void stopMovement();
void startBuilding(const QString &impId, float duration);
void cancelBuilding();
bool isBuilding() const { return state == UnitState::Building; }
bool canAttack(const Unit &other) const;
void performAttack(Unit &target);
void takeDamage(float damage);
bool isDead() const { return health <= 0.001f; }
bool isNaval() const { return config.isNaval(); }
bool isLand() const { return config.isLand(); }
static float getTerrainHeight(float worldX, float worldY, Matrix2D<TerrainPoint> *mapPoints, int numPoints05);
};