#include "glm.hpp" #include "ext.hpp" #include "src/Render_Utils.h" #include "./GameEntity.h" #include "Spaceship.h" #pragma once class Heart : public GameEntity { public: glm::mat4 modelMatrix; glm::mat4 initialModelMatrix; float healAmount = 10; bool isCollected; Heart(glm::mat4 initialModelMatrix, float healAmount) : modelMatrix(initialModelMatrix), initialModelMatrix(initialModelMatrix), healAmount(healAmount), isCollected(false), GameEntity(1, 1, 0) {} virtual ~Heart() = default; virtual bool isAlive() { if (this->currentHP <= 0) { isCollected = true; return false; } return true; } glm::vec3 getPosition() const override { return modelMatrix[3]; } glm::mat4 getModelMatrix() override { return modelMatrix; } void respawn() override { this->currentHP = this->maxHP; this->modelMatrix = this->initialModelMatrix; return; } void heal() override { this->currentHP = this->currentHP + 5.0f; } };