mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-24 15:18:34 +00:00
Bomb collisions should be good
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user