update
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user