grafika_komputerowa/grk/project/Nitro.h

56 lines
993 B
C
Raw Normal View History

2024-02-08 04:44:22 +01:00
#include "glm.hpp"
#include "ext.hpp"
#include "src/Render_Utils.h"
#include "./GameEntity.h"
#include "Spaceship.h"
#pragma once
class Nitro : public GameEntity
{
public:
glm::mat4 modelMatrix;
glm::mat4 initialModelMatrix;
float healAmount = 10;
2024-02-08 04:55:27 +01:00
bool isCollected;
2024-02-08 04:44:22 +01:00
Nitro(glm::mat4 initialModelMatrix, float healAmount)
:
modelMatrix(initialModelMatrix),
initialModelMatrix(initialModelMatrix),
healAmount(healAmount),
2024-02-08 04:55:27 +01:00
isCollected(false),
2024-02-08 04:44:22 +01:00
GameEntity(1, 1, 0)
{}
virtual ~Nitro() = default;
2024-02-08 04:55:27 +01:00
virtual bool isAlive() {
2024-02-08 04:44:22 +01:00
if (this->currentHP <= 0) {
2024-02-08 04:55:27 +01:00
isCollected = true;
2024-02-08 04:44:22 +01:00
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;
}
};