Skip to content

Commit

Permalink
Merge pull request #261 from AnonymusRaccoon/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Octopus773 authored Jun 20, 2021
2 parents d8cf9a9 + 5481f96 commit 2d17eff
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions sources/Component/Controllable/ControllableComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@ namespace BBM
: WAL::Component(entity),
disabled(isDisabled)
{}

void ControllableComponent::disable()
{
this->disabled = true;
this->pause = false;
this->bomb = false;
this->move = Vector2f();
}
}
2 changes: 2 additions & 0 deletions sources/Component/Controllable/ControllableComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace BBM
//! @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.
bool fastClick = false;

void disable();

//! @inherit
WAL::Component *clone(WAL::Entity &entity) const override;

Expand Down
2 changes: 1 addition & 1 deletion sources/Runner/GameScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace BBM
entity.removeComponent<AnimatorComponent>();
if (entity.hasComponent<TimerComponent>())
return;
entity.getComponent<ControllableComponent>().disabled = true;
entity.getComponent<ControllableComponent>().disable();
entity.addComponent<TimerComponent>(1s, [](WAL::Entity &ent, WAL::Wal &) {
if (!ent.hasComponent<SoundComponent>())
return;
Expand Down
4 changes: 1 addition & 3 deletions sources/Runner/PauseMenuScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ namespace BBM
entity.scheduleDeletion();

for (auto &[entity, controller, _] : gameScene->view<ControllableComponent, HealthComponent>()) {
controller.disabled = true;
controller.pause = false;
controller.bomb = false;
controller.disable();
}
for (auto &[_, timer] : gameScene->view<TimerComponent>())
timer.disabled = true;
Expand Down

0 comments on commit 2d17eff

Please sign in to comment.