Merging with bonuses

This commit is contained in:
Zoe Roux
2021-06-10 11:36:16 +02:00
9 changed files with 132 additions and 35 deletions

View File

@@ -17,9 +17,9 @@ using namespace std::chrono_literals;
namespace BBM
{
void MapGenerator::wallCollide(WAL::Entity &entity,
const WAL::Entity &wall,
CollisionComponent::CollidedAxis collidedAxis)
void MapGenerator::wallCollided(WAL::Entity &entity,
const WAL::Entity &wall,
CollisionComponent::CollidedAxis collidedAxis)
{
auto *mov = entity.tryGetComponent<MovableComponent>();
@@ -57,10 +57,9 @@ namespace BBM
entity.scheduleDeletion();
})
.addComponent<LevitateComponent>(position.y)
.addComponent<CollisionComponent>(func[bonusType - 1], [](WAL::Entity &bonus, const WAL::Entity &player, CollisionComponent::CollidedAxis axis) {
.addComponent<CollisionComponent>([](WAL::Entity &bonus, const WAL::Entity &player, CollisionComponent::CollidedAxis axis) {
bonus.scheduleDeletion();
std::cout << "called" << std::endl;
}, 0.5, .5)
}, func[bonusType - 1], 0.5, .5)
.addComponent<TimerComponent>(5s, [](WAL::Entity &bonus, WAL::Wal &wal){
bonus.scheduleDeletion();
})
@@ -94,7 +93,7 @@ namespace BBM
.addComponent<TagComponent<Blowable>>()
.addComponent<CollisionComponent>(
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
&MapGenerator::wallCollide, 0.25, .75)
&MapGenerator::wallCollided, 0.25, .75)
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, false,
std::make_pair(MAP_DIFFUSE, unbreakablePng));
}
@@ -112,7 +111,7 @@ namespace BBM
.addComponent<TagComponent<Blowable>>()
.addComponent<CollisionComponent>(
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
&MapGenerator::wallCollide, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
&MapGenerator::wallCollided, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, false,
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
RAY::Vector3(width + 3, 1, 1));
@@ -121,8 +120,8 @@ namespace BBM
.addComponent<TagComponent<Blowable>>()
.addComponent<CollisionComponent>(
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
&MapGenerator::wallCollide, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, false,
&MapGenerator::wallCollided, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, false,
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
RAY::Vector3(width + 3, 1, 1));
scene->addEntity("Left Wall")
@@ -130,16 +129,16 @@ namespace BBM
.addComponent<TagComponent<Blowable>>()
.addComponent<CollisionComponent>(
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
&MapGenerator::wallCollide, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1))
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, false,
&MapGenerator::wallCollided, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1))
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, false,
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
RAY::Vector3(1, 1, height + 1));
scene->addEntity("Right Wall")
.addComponent<PositionComponent>(Vector3f(-1, 0, height / 2))
.addComponent<CollisionComponent>(
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
&MapGenerator::wallCollide, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1))
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, false,
&MapGenerator::wallCollided, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1))
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, false,
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
RAY::Vector3(1, 1, height + 1));
}
@@ -188,7 +187,7 @@ namespace BBM
.addComponent<HealthComponent>(1, &MapGenerator::wallDestroyed)
.addComponent<CollisionComponent>(
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
&MapGenerator::wallCollide, 0.25, .75)
&MapGenerator::wallCollided, 0.25, .75)
.addComponent<Drawable3DComponent, RAY3D::Model>(breakableObj, false, std::make_pair(MAP_DIFFUSE, breakablePng));
}
@@ -224,7 +223,7 @@ namespace BBM
.addComponent<TagComponent<Blowable>>()
.addComponent<CollisionComponent>(
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
&MapGenerator::wallCollide, 0.25, .75)
&MapGenerator::wallCollided, 0.25, .75)
.addComponent<Drawable3DComponent, RAY3D::Model>(UnbreakableObj, false,
std::make_pair(MAP_DIFFUSE, UnbreakablePng));
}