mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-07 03:25:10 +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;
|
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)
|
BombHolderSystem::BombHolderSystem(WAL::Wal &wal)
|
||||||
: System(wal)
|
: System(wal)
|
||||||
{}
|
{}
|
||||||
@@ -54,8 +65,8 @@ namespace BBM
|
|||||||
this->_wal.scene->scheduleNewEntity("Bomb")
|
this->_wal.scene->scheduleNewEntity("Bomb")
|
||||||
.addComponent<PositionComponent>(position.round())
|
.addComponent<PositionComponent>(position.round())
|
||||||
.addComponent<TimerComponent>(BombHolderSystem::explosionTimer, &BombHolderSystem::_bombExplosion)
|
.addComponent<TimerComponent>(BombHolderSystem::explosionTimer, &BombHolderSystem::_bombExplosion)
|
||||||
// .addComponent<CollisionComponent>(WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
.addComponent<CollisionComponent>(WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
// &MapGenerator::wallCollide, 0.25, .75)
|
&BombHolderSystem::_bombCollide, 0.25, .75)
|
||||||
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/bombs/bomb.obj",
|
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/bombs/bomb.obj",
|
||||||
std::make_pair(MAP_DIFFUSE, "assets/bombs/bomb_normal.png"));
|
std::make_pair(MAP_DIFFUSE, "assets/bombs/bomb_normal.png"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <System/System.hpp>
|
#include <System/System.hpp>
|
||||||
#include <Wal.hpp>
|
#include <Wal.hpp>
|
||||||
|
#include <Component/Collision/CollisionComponent.hpp>
|
||||||
#include "Models/Vector3.hpp"
|
#include "Models/Vector3.hpp"
|
||||||
#include "Component/Position/PositionComponent.hpp"
|
#include "Component/Position/PositionComponent.hpp"
|
||||||
#include "Component/BombHolder/BombHolderComponent.hpp"
|
#include "Component/BombHolder/BombHolderComponent.hpp"
|
||||||
@@ -25,6 +26,9 @@ namespace BBM
|
|||||||
|
|
||||||
//! @brief The method triggered when the bomb explode.
|
//! @brief The method triggered when the bomb explode.
|
||||||
static void _bombExplosion(WAL::Entity &bomb, WAL::Wal &);
|
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:
|
public:
|
||||||
//! @brief The explosion time of new bombs.
|
//! @brief The explosion time of new bombs.
|
||||||
static std::chrono::nanoseconds explosionTimer;
|
static std::chrono::nanoseconds explosionTimer;
|
||||||
|
|||||||
Reference in New Issue
Block a user