Add Alot
This commit is contained in:
@@ -5,16 +5,16 @@
|
||||
#include <utility>
|
||||
|
||||
#include "colors.h"
|
||||
#include "GameManager.h"
|
||||
#include "Player.h"
|
||||
#include "utils.h"
|
||||
Building::Building(const std::string& filePath, const Vector2f& position, const Rectf& boundingBox, TextureManager* pTextureManager): m_Position(position),
|
||||
m_BoundingBox(boundingBox) {
|
||||
m_Texture = pTextureManager->GetTexture(filePath);
|
||||
m_Size = Vector2f(m_Texture->GetWidth(), m_Texture->GetHeight());
|
||||
std::cout << "i like kids" << std::endl;
|
||||
}
|
||||
Building::~Building() = default;
|
||||
|
||||
void Building::Draw() const {
|
||||
utils::SetColor(Colors::WHITE);
|
||||
m_Texture->Draw(m_Position);
|
||||
utils::SetColor(Colors::GREEN);
|
||||
Rectf temp = m_BoundingBox;
|
||||
@@ -24,15 +24,20 @@ void Building::Draw() const {
|
||||
}
|
||||
void Building::Update(float dt, const Rectf& objectBoundingBox) {
|
||||
if (IsObjectInHitbox(objectBoundingBox)) {
|
||||
if (!m_IsPlayerInHitbox) { //TODO: what
|
||||
m_IsPlayerInHitbox = true;
|
||||
if (m_OnEnterHitbox != nullptr) {
|
||||
m_OnEnterHitbox();
|
||||
}
|
||||
else {
|
||||
std::cout << "No function set for onEnterHitbox" << std::endl;
|
||||
Player* player = GameManager::GetInstance().GetPlayer();
|
||||
float speed = player->GetVelocity().Length();
|
||||
if (speed < 100.0f) {
|
||||
if (!m_IsPlayerInHitbox) {
|
||||
m_IsPlayerInHitbox = true;
|
||||
if (m_OnEnterHitbox != nullptr) {
|
||||
m_OnEnterHitbox();
|
||||
}
|
||||
else {
|
||||
std::cout << "No function set for onEnterHitbox" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
m_IsPlayerInHitbox = false;
|
||||
|
||||
Reference in New Issue
Block a user