mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-05 02:49:57 +00:00
Real bombs collisions but waiting for origin/bonus to be merged
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user