Bomb collisions should be good

This commit is contained in:
Zoe Roux
2021-06-10 11:31:32 +02:00
parent 4485f36aa2
commit 5646c0ecbd
7 changed files with 32 additions and 30 deletions
+15 -6
View File
@@ -2,19 +2,28 @@
// Created by Zoe Roux on 6/9/21.
//
#include <Component/BombHolder/BombHolderComponent.hpp>
#include "BombSystem.hpp"
namespace BBM
{
BombSystem::BombSystem(WAL::Wal &wal)
: System(wal)
{
{}
}
void BombSystem::onUpdate(WAL::ViewEntity<BasicBombComponent> &entity, std::chrono::nanoseconds dtime)
void BombSystem::onUpdate(WAL::ViewEntity<BasicBombComponent, PositionComponent> &entity, std::chrono::nanoseconds dtime)
{
// if (entity.get<BasicBombComponent>().)
// TODO set ignoreOwner to false once the player moved out of the block.
auto &bomb = entity.get<BasicBombComponent>();
if (!bomb.ignoreOwner)
return;
auto &pos = entity.get<PositionComponent>();
for (auto &[owner, ownerPos, _] : this->_wal.getScene()->view<PositionComponent, BombHolderComponent>()) {
if (owner.getUid() != bomb.ownerID)
continue;
if (pos.position != ownerPos.position.round()) {
bomb.ignoreOwner = false;
return;
}
}
}
}