mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-31 09:32:02 +00:00
include collisioncomponent missing
This commit is contained in:
+17
-16
@@ -2,42 +2,43 @@
|
||||
// Created by HENRY Benjamin on 02/06/2021.
|
||||
//
|
||||
|
||||
#include "Component/Movable/MovableComponent.hpp"
|
||||
#include "Bonus.hpp"
|
||||
//#include "Component/BombHolderComponent/BombHolderComponent.hpp"
|
||||
|
||||
namespace BBM {
|
||||
void Bonus::BombUpBonus(const WAL::Entity &entity, const WAL::Entity &other)
|
||||
void Bonus::BombUpBonus(WAL::Entity &entity, const WAL::Entity &other)
|
||||
{
|
||||
auto &bombHolder = other.getComponent<BombHolderComponent>();
|
||||
bombHolder.maxBombCount++;
|
||||
//entity.scheduleDeletion(true);
|
||||
//auto &bombHolder = entity.getComponent<BombHolderComponent>();
|
||||
//bombHolder.maxBombCount++;
|
||||
//other.scheduleDeletion(true);
|
||||
}
|
||||
|
||||
void Bonus::DamageIncreasedBonus(const WAL::Entity &entity, const WAL::Entity &other)
|
||||
void Bonus::DamageIncreasedBonus(WAL::Entity &entity, const WAL::Entity &other)
|
||||
{
|
||||
auto &bombHolder = other.getComponent<BombHolderComponent>();
|
||||
//auto &bombHolder = entity.getComponent<BombHolderComponent>();
|
||||
//bombHolder.damage++;
|
||||
//entity.scheduleDeletion(true);
|
||||
//other.scheduleDeletion(true);
|
||||
}
|
||||
|
||||
void Bonus::ExplosionRangeBonus(const WAL::Entity &entity, const WAL::Entity &other)
|
||||
void Bonus::ExplosionRangeBonus(WAL::Entity &entity, const WAL::Entity &other)
|
||||
{
|
||||
auto &bombHolder = other.getComponent<BombHolderComponent>();
|
||||
//auto &bombHolder = entity.getComponent<BombHolderComponent>();
|
||||
//bombHolder.explosionRange++;
|
||||
//entity.scheduleDeletion(true);
|
||||
//other.scheduleDeletion(true);
|
||||
}
|
||||
|
||||
void Bonus::SpeedUpBonus(const WAL::Entity &entity, const WAL::Entity &other)
|
||||
void Bonus::SpeedUpBonus(WAL::Entity &entity, const WAL::Entity &other)
|
||||
{
|
||||
auto &movable = other.getComponent<MovableComponent>();
|
||||
auto &movable = entity.getComponent<MovableComponent>();
|
||||
movable.addForce(Vector3f(1, 0, 1));
|
||||
//entity.scheduleDeletion(true);
|
||||
//other.scheduleDeletion(true);
|
||||
}
|
||||
|
||||
void Bonus::IgnoreWallsBonus(const WAL::Entity &entity, const WAL::Entity &other)
|
||||
void Bonus::IgnoreWallsBonus(WAL::Entity &entity, const WAL::Entity &other)
|
||||
{
|
||||
auto &bombHolder = other.getComponent<BombHolderComponent>();
|
||||
//auto &bombHolder = entity.getComponent<BombHolderComponent>();
|
||||
//bombHolder.ignoreWall = false;
|
||||
//entity.scheduleDeletion(true);
|
||||
//other.scheduleDeletion(true);
|
||||
}
|
||||
}
|
||||
+15
-15
@@ -10,29 +10,29 @@
|
||||
namespace BBM {
|
||||
class Bonus {
|
||||
public:
|
||||
//! @param entity bonus
|
||||
//! @param other the entity on which the effect will be applied
|
||||
//! @param other bonus
|
||||
//! @param entity the entity on which the effect will be applied
|
||||
//! @brief Apply bonus effect that allows players to carry one more bomb than before
|
||||
static void BombUpBonus(const WAL::Entity &entity, const WAL::Entity &other);
|
||||
static void BombUpBonus(WAL::Entity &entity, const WAL::Entity &other);
|
||||
|
||||
//! @param entity bonus
|
||||
//! @param other the entity on which the effect will be applied
|
||||
//! @param other bonus
|
||||
//! @param entity the entity on which the effect will be applied
|
||||
//! @brief Apply bonus effect who increased the bomb damage
|
||||
static void DamageIncreasedBonus(const WAL::Entity &entity, const WAL::Entity &other);
|
||||
static void DamageIncreasedBonus(WAL::Entity &entity, const WAL::Entity &other);
|
||||
|
||||
//! @param entity bonus
|
||||
//! @param other the entity on which the effect will be applied
|
||||
//! @param other bonus
|
||||
//! @param entity the entity on which the effect will be applied
|
||||
//! @brief Apply bonus effect that expend the explosion range of the bomb
|
||||
static void ExplosionRangeBonus(const WAL::Entity &entity, const WAL::Entity &other);
|
||||
static void ExplosionRangeBonus(WAL::Entity &entity, const WAL::Entity &other);
|
||||
|
||||
//! @param entity bonus
|
||||
//! @param other the entity on which the effect will be applied
|
||||
//! @param other bonus
|
||||
//! @param entity the entity on which the effect will be applied
|
||||
//! @brief Apply bonus effect that allows to run faster
|
||||
static void SpeedUpBonus(const WAL::Entity &entity, const WAL::Entity &other);
|
||||
static void SpeedUpBonus(WAL::Entity &entity, const WAL::Entity &other);
|
||||
|
||||
//! @param entity bonus
|
||||
//! @param other the entity on which the effect will be applied
|
||||
//! @param other bonus
|
||||
//! @param entity the entity on which the effect will be applied
|
||||
//! @brief Apply bonus effect that allows bomb explosion to pass through walls
|
||||
static void IgnoreWallsBonus(const WAL::Entity &entity, const WAL::Entity &other);
|
||||
static void IgnoreWallsBonus(WAL::Entity &entity, const WAL::Entity &other);
|
||||
};
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <Component/Position/PositionComponent.hpp>
|
||||
#include <Component/Renderer/Drawable3DComponent.hpp>
|
||||
#include <map>
|
||||
#include "Component/Collision/CollisionComponent.hpp"
|
||||
#include "HealthSystem.hpp"
|
||||
#include "Component/Health/HealthComponent.hpp"
|
||||
#include "Component/Bonus/BonusComponent.hpp"
|
||||
@@ -25,14 +26,14 @@ namespace BBM
|
||||
|
||||
void HealthSystem::_createBonus(Vector3f position, BonusComponent::BonusType bonusType, std::chrono::nanoseconds timer)
|
||||
{
|
||||
std::map<BonusComponent::BonusType, std::string> map = {
|
||||
static std::map<BonusComponent::BonusType, std::string> map = {
|
||||
{BonusComponent::BonusType::BOMBSTOCK, "assets/items/bombup"},
|
||||
{BonusComponent::BonusType::SPEEDUP, "assets/items/speedup"},
|
||||
//{BonusComponent::BonusType::EXPLOSIONINC, "assets/items/explosion"},
|
||||
{BonusComponent::BonusType::DAMAGEINC, "assets/items/fireup"},
|
||||
{BonusComponent::BonusType::IGNOREWALLS, "assets/items/wallpass"}
|
||||
};
|
||||
std::vector<std::function<void (const WAL::Entity &, const WAL::Entity &)>> func = {
|
||||
static std::vector<std::function<void (WAL::Entity &, const WAL::Entity &)>> func = {
|
||||
&Bonus::BombUpBonus, &Bonus::SpeedUpBonus, &Bonus::ExplosionRangeBonus,
|
||||
&Bonus::DamageIncreasedBonus, &Bonus::IgnoreWallsBonus
|
||||
};
|
||||
@@ -43,7 +44,7 @@ namespace BBM
|
||||
this->_wal.scene->addEntity("Bonus")
|
||||
.addComponent<PositionComponent>(position)
|
||||
.addComponent<HealthComponent>(1)
|
||||
//.addComponent<CollisionComponent>(1, func[bonusType -1])
|
||||
.addComponent<CollisionComponent>(func[bonusType - 1], [](WAL::Entity &, const WAL::Entity &){}, 5.0)
|
||||
//.addComponent<TimerComponent>(timer, &[](WAL::Entity &bonus){
|
||||
// std::cout << "Bonus disappeared" << std::endl;
|
||||
// bonus.scheduleDeletion();
|
||||
|
||||
Reference in New Issue
Block a user