#include "pch.h"
#include "WorldTile.h"

#include "TextureManager.h"
#include "utils.h"

WorldTile::WorldTile() {
	
}
WorldTile::WorldTile(const Point2f& position, GroundTileTypes groundTileType, TextureManager* pTextureManager) : m_Position { position }, m_GroundTileType { groundTileType } {
	const std::string dirtPath =  + "tiles/dirt/dirt" + std::to_string(utils::randRange(1, 5))  + ".png";
	// m_pTexture = new Texture(dirtPath);
	m_pTexture = pTextureManager->GetTexture(dirtPath);
}
WorldTile::~WorldTile() {
	delete m_pTexture;
}
void WorldTile::Draw() const {
	if (m_GroundTileType != GroundTileTypes::Air) {
		m_pTexture->Draw(m_Position);
		//utils::SetColor(Color4f{ 0.5f, 0.5f, 0.5f, 1.0f});
		//utils::FillRect(m_Position.x, m_Position.y, 50, 50);
	}
}
Collision::TileCollisionRect WorldTile::GetCollisionRect() {
	return Collision::TileCollisionRect{ m_Position, GetSize(), (this)};
}
