indent issues

This commit is contained in:
Clément Le Bihan
2021-06-14 10:47:12 +02:00
parent ad71799c52
commit 7fb62d10f4
2 changed files with 40 additions and 22 deletions
+17 -10
View File
@@ -22,20 +22,23 @@ namespace BBM
std::chrono::nanoseconds BombHolderSystem::explosionTimer = 2s;
void BombHolderSystem::_bombCollide(WAL::Entity &entity,
const WAL::Entity &bomb,
CollisionComponent::CollidedAxis collidedAxis)
const WAL::Entity &bomb,
CollisionComponent::CollidedAxis collidedAxis)
{
auto &bombInfo = bomb.getComponent<BasicBombComponent>();
if (bombInfo.ignoreOwner && bombInfo.ownerID == entity.getUid())
return;
return MapGenerator::wallCollided( entity, bomb, collidedAxis);
return MapGenerator::wallCollided(entity, bomb, collidedAxis);
}
BombHolderSystem::BombHolderSystem(WAL::Wal &wal)
: System(wal)
{}
void BombHolderSystem::_dispatchExplosion(const Vector3f &position, WAL::Wal &wal, int radiusToDo, ExpansionDirection expansionDirections)
void BombHolderSystem::_dispatchExplosion(const Vector3f &position,
WAL::Wal &wal,
int radiusToDo,
ExpansionDirection expansionDirections)
{
if (radiusToDo <= 0)
return;
@@ -45,7 +48,8 @@ namespace BBM
explosion.scheduleDeletion();
})
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/bombs/explosion/explosion.glb", false,
std::make_pair(MAP_DIFFUSE, "assets/bombs/explosion/blast.png"));
std::make_pair(MAP_DIFFUSE,
"assets/bombs/explosion/blast.png"));
wal.getSystem<EventSystem>().dispatchEvent([position, radiusToDo, expansionDirections](WAL::Wal &wal) {
for (auto &[entity, pos, _] : wal.getScene()->view<PositionComponent, TagComponent<Blowable>>()) {
if (pos.position.round() == position) {
@@ -83,16 +87,19 @@ namespace BBM
.addComponent<PositionComponent>(position.round())
.addComponent<BasicBombComponent>(holder.damage, holder.explosionRadius, id)
.addComponent<TimerComponent>(BombHolderSystem::explosionTimer, &BombHolderSystem::_bombExplosion)
.addComponent<CollisionComponent>(WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
&BombHolderSystem::_bombCollide, 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", false,
std::make_pair(MAP_DIFFUSE, "assets/bombs/bomb_normal.png"));
std::make_pair(MAP_DIFFUSE,
"assets/bombs/bomb_normal.png"));
holder.damage = 1;
holder.explosionRadius = 3;
}
void BombHolderSystem::onUpdate(WAL::ViewEntity<PositionComponent, BombHolderComponent, ControllableComponent> &entity,
std::chrono::nanoseconds dtime)
void
BombHolderSystem::onUpdate(WAL::ViewEntity<PositionComponent, BombHolderComponent, ControllableComponent> &entity,
std::chrono::nanoseconds dtime)
{
auto &holder = entity.get<BombHolderComponent>();
auto &position = entity.get<PositionComponent>();
+23 -12
View File
@@ -14,7 +14,8 @@
namespace BBM
{
enum ExpansionDirection {
enum ExpansionDirection
{
UP = 1,
DOWN = 2,
LEFT = 4,
@@ -31,26 +32,33 @@ namespace BBM
void _spawnBomb(Vector3f position, BombHolderComponent &holder, unsigned id);
//! @brief Spawn a bomb at the specified position.
static void _dispatchExplosion(const Vector3f &position, WAL::Wal &wal, int radiusToDo, ExpansionDirection expansionDirections);
static void _dispatchExplosion(const Vector3f &position, WAL::Wal &wal, int radiusToDo,
ExpansionDirection expansionDirections);
//! @brief Wrapped call to specify default arg value
inline static void _dispatchExplosion(const Vector3f &position, WAL::Wal &wal, int radiusToDo) {
inline static void _dispatchExplosion(const Vector3f &position, WAL::Wal &wal, int radiusToDo)
{
return _dispatchExplosion(position,
wal,
radiusToDo,
static_cast<ExpansionDirection>(ExpansionDirection::DOWN
| ExpansionDirection::UP
| ExpansionDirection::FRONT
| ExpansionDirection::BACK
| ExpansionDirection::LEFT
| ExpansionDirection::RIGHT));
wal,
radiusToDo,
static_cast<ExpansionDirection>(
ExpansionDirection::DOWN
| ExpansionDirection::UP
| ExpansionDirection::FRONT
| ExpansionDirection::BACK
| ExpansionDirection::LEFT
| ExpansionDirection::RIGHT
)
);
};
//! @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);
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;
@@ -61,10 +69,13 @@ namespace BBM
//! @brief A default constructor
explicit BombHolderSystem(WAL::Wal &wal);
//! @brief A bomb holder system is copy constructable
BombHolderSystem(const BombHolderSystem &) = default;
//! @brief A default destructor
~BombHolderSystem() override = default;
//! @brief A bomb holder system is not assignable.
BombHolderSystem &operator=(const BombHolderSystem &) = delete;
};