almoos dere

This commit is contained in:
MarcEricMartel
2023-12-18 13:29:38 -05:00
parent 68d03c1eac
commit f1bb7447f9
14 changed files with 125 additions and 68 deletions

View File

@@ -84,7 +84,7 @@ Vector3f Player::GetInput(bool front, bool back, bool left, bool right, bool jum
return delta;
}
Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTime, Booster booster_table[]) {
Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTime, std::unordered_map<uint64_t, Booster*> booster_table) {
Player::Sound snd = Player::Sound::NOSOUND;
static float timing = 0.f;
/* Gestion de collisions */
@@ -196,16 +196,16 @@ void Player::ApplyTransformation(Transformation& transformation, bool rel, bool
if (rel) transformation.ApplyTranslation(-GetPOV());
}
void Player::TakeBooster(Booster booster_table[], float elapsedtime)
void Player::TakeBooster(std::unordered_map<uint64_t, Booster*> booster_table, float elapsedtime)
{
Vector3f playerpos = GetPosition();
for (int i = 0; i < sizeof(booster_table); i++)
for (auto& [key, booster]: booster_table)
{
Vector3f pos = booster_table[i].GetPosition();
if (abs(playerpos.x - pos.x) <= 0.5f && abs(playerpos.y - pos.y) <= 1.0f && abs(playerpos.z - pos.z) <= 0.5f && booster_table[i].GetAvailability() == true)
Vector3f pos = booster->GetPosition();
if (booster->GetAvailability() && abs(playerpos.x - pos.x) <= 0.5f && abs(playerpos.y - pos.y) <= 1.0f && abs(playerpos.z - pos.z) <= 0.5f)
{
GetBooster(booster_table[i].GetType(), elapsedtime);
booster_table[i].SetAvailability(false);
GetBooster(booster->GetType(), elapsedtime);
booster->SetAvailability(false);
break;
}
}