2019-04-15 14:12:59 -07:00
|
|
|
//
|
|
|
|
// Created by aurailus on 14/04/19.
|
|
|
|
//
|
|
|
|
|
2019-08-24 17:39:35 -07:00
|
|
|
#pragma once
|
2019-04-15 14:12:59 -07:00
|
|
|
|
2019-08-31 23:58:38 -07:00
|
|
|
#include "../Entity.h"
|
2020-07-06 18:34:59 -07:00
|
|
|
|
2020-07-21 19:33:26 -07:00
|
|
|
class BlockDef;
|
2020-07-06 18:34:59 -07:00
|
|
|
class AtlasRef;
|
|
|
|
class MeshPart;
|
2020-07-21 19:33:26 -07:00
|
|
|
class EntityVertex;
|
|
|
|
class TextureAtlas;
|
2019-04-15 14:12:59 -07:00
|
|
|
|
2019-05-14 12:05:54 -07:00
|
|
|
class BlockCrackEntity : public Entity {
|
2019-04-15 14:12:59 -07:00
|
|
|
public:
|
2020-07-21 19:33:26 -07:00
|
|
|
BlockCrackEntity(BlockDef &def, TextureAtlas& textureAtlas, glm::ivec3 pos);
|
2019-04-15 14:12:59 -07:00
|
|
|
|
2019-05-14 12:05:54 -07:00
|
|
|
void update();
|
2020-07-21 19:33:26 -07:00
|
|
|
void addDamage(double damage);
|
2020-07-28 14:11:11 -07:00
|
|
|
void setDamage(double damage);
|
2020-07-21 19:33:26 -07:00
|
|
|
|
|
|
|
int maxHealth = 0;
|
|
|
|
double damage = 0;
|
|
|
|
double damagePending = 0;
|
2019-05-01 19:57:50 -07:00
|
|
|
|
|
|
|
double time = 0;
|
2020-07-21 19:33:26 -07:00
|
|
|
BlockDef& def;
|
2019-04-15 14:12:59 -07:00
|
|
|
private:
|
2019-08-13 01:52:45 -07:00
|
|
|
void addFaces(unsigned int &indOffset, std::vector<EntityVertex> &vertices, std::vector<unsigned int> &indices, std::vector<MeshPart> &meshParts);
|
2019-04-15 14:12:59 -07:00
|
|
|
|
2020-07-21 19:33:26 -07:00
|
|
|
short crackLevel = -1;
|
|
|
|
|
|
|
|
TextureAtlas& textureAtlas;
|
2019-05-01 14:49:39 -07:00
|
|
|
std::vector<std::shared_ptr<AtlasRef>> crackedFaces;
|
2019-04-15 14:12:59 -07:00
|
|
|
};
|