34 lines
680 B
C++
34 lines
680 B
C++
#include "glm.hpp"
|
|
|
|
#pragma once
|
|
class GameEntity
|
|
{
|
|
public:
|
|
float currentHP;
|
|
float dmg;
|
|
float maxHP;
|
|
float initDMG;
|
|
|
|
GameEntity(float currentHP, float maxHP, float initialDmg)
|
|
: currentHP(currentHP), maxHP(maxHP), dmg(initialDmg), initDMG(initialDmg)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
virtual void applyDamage(float attackerDmg) {
|
|
currentHP = currentHP - attackerDmg;
|
|
};
|
|
virtual glm::vec3 getPosition() const = 0;
|
|
virtual glm::mat4 getModelMatrix() = 0;
|
|
virtual bool isAlive() {
|
|
if (this->currentHP <= 0) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
virtual void respawn() = 0;
|
|
virtual void heal() = 0;
|
|
};
|
|
|