mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-03 10:26:29 +00:00
merge develop
This commit is contained in:
@@ -12,9 +12,10 @@ namespace BBM
|
||||
: WAL::Component(entity)
|
||||
{}
|
||||
|
||||
BombHolderComponent::BombHolderComponent(WAL::Entity &entity, unsigned int maxCount)
|
||||
BombHolderComponent::BombHolderComponent(WAL::Entity &entity, unsigned int maxCount, unsigned int bombExplosionRadius)
|
||||
: WAL::Component(entity),
|
||||
maxBombCount(maxCount)
|
||||
maxBombCount(maxCount),
|
||||
explosionRadius(bombExplosionRadius)
|
||||
{}
|
||||
|
||||
WAL::Component *BombHolderComponent::clone(WAL::Entity &entity) const
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace BBM
|
||||
//! @brief The number of nanosecond before the next bomb refill.
|
||||
std::chrono::nanoseconds nextBombRefill = refillRate;
|
||||
//! @brief The radius of the explosion.
|
||||
float explosionRadius = 3;
|
||||
unsigned int explosionRadius = 3;
|
||||
//! @brief The damage made by the explosion on an entity
|
||||
int damage = 1;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace BBM
|
||||
explicit BombHolderComponent(WAL::Entity &entity);
|
||||
|
||||
//! @brief Constructor
|
||||
BombHolderComponent(WAL::Entity &entity, unsigned int maxBombCount);
|
||||
BombHolderComponent(WAL::Entity &entity, unsigned int maxBombCount, unsigned int bombExplosionRadius = 3);
|
||||
|
||||
//! @brief A component can't be instantiated, it should be derived.
|
||||
BombHolderComponent(const BombHolderComponent &) = default;
|
||||
|
||||
@@ -40,8 +40,6 @@ namespace BBM
|
||||
bool bomb = false;
|
||||
//! @brief input value for pause
|
||||
bool pause = false;
|
||||
//! @brief The speed applied to every controllable entities.
|
||||
float speed = .15f;
|
||||
//! @brief The layout used for this controllable.
|
||||
Layout layout = NONE;
|
||||
//! @brief True if buttons should be triggered every frame where the key is down, false if the button should only be triggered once the key is released.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Created by hbenjamin on 6/18/21.
|
||||
//
|
||||
|
||||
#include "ResumeLobbyComponent.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
ResumeLobbyComponent::ResumeLobbyComponent(WAL::Entity &entity, int playerNumber, WAL::Entity &button, WAL::Entity &tile, int pColor)
|
||||
: WAL::Component(entity),
|
||||
playerID(playerNumber),
|
||||
playerColor(pColor),
|
||||
readyButton(button),
|
||||
coloredTile(tile)
|
||||
{}
|
||||
|
||||
WAL::Component *ResumeLobbyComponent::clone(WAL::Entity &entity) const
|
||||
{
|
||||
return new ResumeLobbyComponent(entity, this->playerID, this->readyButton, this->coloredTile, this->playerColor);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Created by hbenjamin on 6/18/21.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Component/Component.hpp>
|
||||
#include <Entity/Entity.hpp>
|
||||
#include <Color.hpp>
|
||||
#include <Component/Controllable/ControllableComponent.hpp>
|
||||
#include <chrono>
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
class ResumeLobbyComponent : public WAL::Component
|
||||
{
|
||||
public:
|
||||
//! @brief The layout used for this player.
|
||||
ControllableComponent::Layout layout = ControllableComponent::NONE;
|
||||
//! @brief The ID of the lobby player (from 0 to 3)
|
||||
int playerID;
|
||||
//! @brief The color of the player (as an index)
|
||||
int playerColor;
|
||||
//! @brief Is this player ready
|
||||
bool ready = false;
|
||||
//! @brief The entity containing the ready display.
|
||||
WAL::Entity &readyButton;
|
||||
//! @brief The colored rectangle behind the player.
|
||||
WAL::Entity &coloredTile;
|
||||
//! @brief The time of last input that this lobby player has made.
|
||||
std::chrono::time_point<std::chrono::steady_clock> lastInput;
|
||||
|
||||
Component *clone(WAL::Entity &entity) const override;
|
||||
|
||||
//! @brief Create a new lobby component.
|
||||
explicit ResumeLobbyComponent(WAL::Entity &entity, int playerNumber, WAL::Entity &button, WAL::Entity &tile, int pColor);
|
||||
//! @brief A lobby component is copyable.
|
||||
ResumeLobbyComponent(const ResumeLobbyComponent &) = default;
|
||||
//! @brief A default destructor
|
||||
~ResumeLobbyComponent() override = default;
|
||||
//! @brief A lobby component is not assignable.
|
||||
ResumeLobbyComponent &operator=(const ResumeLobbyComponent &) = delete;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Created by cbihan on 18/06/2021.
|
||||
//
|
||||
|
||||
#include "SpeedComponent.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
SpeedComponent::SpeedComponent(WAL::Entity &entity) :
|
||||
WAL::Component(entity)
|
||||
{
|
||||
}
|
||||
|
||||
WAL::Component *SpeedComponent::clone(WAL::Entity &entity) const
|
||||
{
|
||||
return new SpeedComponent(this->_entity, this->speed);
|
||||
}
|
||||
|
||||
SpeedComponent::SpeedComponent(WAL::Entity &entity, float entitySpeed) :
|
||||
WAL::Component(entity),
|
||||
speed(entitySpeed)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Created by cbihan on 18/06/2021.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Component/Component.hpp>
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
class SpeedComponent : public WAL::Component
|
||||
{
|
||||
public:
|
||||
//! @brief entity speed
|
||||
float speed = .15f;
|
||||
|
||||
//! @inherit
|
||||
WAL::Component *clone(WAL::Entity &entity) const override;
|
||||
|
||||
//! @brief Initialize a new controllable component.
|
||||
explicit SpeedComponent(WAL::Entity &entity);
|
||||
|
||||
//! @brief Initialize a new controllable component.
|
||||
explicit SpeedComponent(WAL::Entity &entity, float entitySpeed);
|
||||
//! @brief A Controllable component is copy constructable.
|
||||
SpeedComponent(const SpeedComponent &) = default;
|
||||
//! @brief default destructor
|
||||
~SpeedComponent() override = default;
|
||||
//! @brief A Controllable component can't be assigned
|
||||
SpeedComponent &operator=(const SpeedComponent &) = delete;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -61,4 +61,5 @@ namespace BBM
|
||||
constexpr const char Bumper[] = "Bumper";
|
||||
// interact with bombs (getting damage etc) but doesn't stop explosion
|
||||
constexpr const char BlowablePass[] = "BlowablePass";
|
||||
constexpr const char Timer[] = "Timer";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user