#include "Gameplay/SpriteBlockType.h"
SpriteBlockType* SpriteBlockType::m_SpriteBlockTypes[NUM_TOTAL_SPRITES];
SpriteBlockType::SpriteBlockType(unsigned int _textureID, unsigned char _ID, std::wstring _name, std::wstring _desc, unsigned char _xSize, unsigned char _ySize, unsigned char _hardness, unsigned char _maxWaterLevel, unsigned char _rowsCount, unsigned char _columnsCount, unsigned char _FPS, float _offset, bool _halfAnimation,
float _xTexLD, float _yTexLD,
float _xTexLU, float _yTexLU,
float _xTexRU, float _yTexRU,
float _xTexRD, float _yTexRD)
: Animation(_textureID, _ID, _xSize, _ySize, _rowsCount, _columnsCount, _FPS, _offset, _halfAnimation, true, _name, _desc,
_xTexLD, _yTexLD,
_xTexLU, _yTexLU,
_xTexRU, _yTexRU,
_xTexRD, _yTexRD)
{
m_ID = _ID;
m_Name = _name;
m_Desc = _desc;
m_TextureID = _textureID;
m_Hardness = _hardness;
m_MaxWaterLevel = _maxWaterLevel;
m_CurrentWaterLevel = (int) (_ID / (float)MINERALS_COUNT);
};
SpriteBlockType::~SpriteBlockType(void)
{
};
unsigned int SpriteBlockType::TextureIDFromTypeID(unsigned int _typeID)
{
unsigned int bRes = -1;
for (unsigned int i = 0; i < NUM_TOTAL_SPRITES; i++)
{
if (NULL == m_SpriteBlockTypes[i])
continue;
if (_typeID == m_SpriteBlockTypes[i]->m_ID)
bRes = m_SpriteBlockTypes[i]->m_TextureID;
}
return bRes;
};