Real bombs collisions but waiting for origin/bonus to be merged

This commit is contained in:
Zoe Roux
2021-06-09 14:36:19 +02:00
parent 78da9a5ccc
commit 84ff472f2a
2 changed files with 17 additions and 2 deletions
+13 -2
View File
@@ -19,6 +19,17 @@ namespace BBM
{
std::chrono::nanoseconds BombHolderSystem::explosionTimer = 3s;
void BombHolderSystem::_bombCollide(WAL::Entity &entity,
const WAL::Entity &bomb,
CollisionComponent::CollidedAxis collidedAxis)
{
auto &bombInfo = bomb.getComponent<BasicBombComponent>();
if (bombInfo.skipOwner && bombInfo.owner == entity)
return;
return MapGenerator::wallCollide(entity, bomb, collidedAxis);
}
BombHolderSystem::BombHolderSystem(WAL::Wal &wal)
: System(wal)
{}
@@ -54,8 +65,8 @@ namespace BBM
this->_wal.scene->scheduleNewEntity("Bomb")
.addComponent<PositionComponent>(position.round())
.addComponent<TimerComponent>(BombHolderSystem::explosionTimer, &BombHolderSystem::_bombExplosion)
// .addComponent<CollisionComponent>(WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
// &MapGenerator::wallCollide, 0.25, .75)
.addComponent<CollisionComponent>(WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
&BombHolderSystem::_bombCollide, 0.25, .75)
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/bombs/bomb.obj",
std::make_pair(MAP_DIFFUSE, "assets/bombs/bomb_normal.png"));
}
@@ -6,6 +6,7 @@
#include <System/System.hpp>
#include <Wal.hpp>
#include <Component/Collision/CollisionComponent.hpp>
#include "Models/Vector3.hpp"
#include "Component/Position/PositionComponent.hpp"
#include "Component/BombHolder/BombHolderComponent.hpp"
@@ -25,6 +26,9 @@ namespace BBM
//! @brief The method triggered when the bomb explode.
static void _bombExplosion(WAL::Entity &bomb, WAL::Wal &);
//! @brief The method called when a player collide with a bomb.
static void _bombCollide(WAL::Entity &entity, const WAL::Entity &wall, BBM::CollisionComponent::CollidedAxis collidedAxis);
public:
//! @brief The explosion time of new bombs.
static std::chrono::nanoseconds explosionTimer;