Commit 04c1bfc1 authored by Kevin Balz's avatar Kevin Balz

Force feedback

parent 1a7a5219
Pipeline #3460 passed with stage
in 7 minutes and 36 seconds
......@@ -15,7 +15,7 @@
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"configurationType": "MinSizeRel",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
......
......@@ -4,9 +4,12 @@
#include <mirrage/utils/log.hpp>
#include <mirrage/utils/min_max.hpp>
#include <mirrage/input/events.hpp>
namespace phase_shifter::gameplay {
using namespace mirrage::input;
namespace {
auto smootherstep(float edge0, float edge1, float x)
{
......@@ -43,6 +46,7 @@ namespace phase_shifter::gameplay {
_beat_index++;
LOG(plog::debug) << "beat";
_bus.send<Screen_shake_msg>(0.03f, 0.05f);
_bus.send<Force_feedback>(static_cast<Input_source>(-1), 0.02f);
beats_left = size - 1 - _beat_index + _beat_offset;
if(beats_left <= 0 || _beat_index + 1 >= size) {
......
......@@ -8,11 +8,13 @@
#include <mirrage/ecs/components/transform_comp.hpp>
#include <mirrage/ecs/entity_set_view.hpp>
#include <mirrage/input/events.hpp>
namespace phase_shifter::gameplay {
using mirrage::ecs::components::Transform_comp;
using namespace mirrage::input;
namespace {
constexpr auto damage_beat_penalty = 5;
......@@ -30,7 +32,10 @@ namespace phase_shifter::gameplay {
_mailbox.subscribe_to([&](Damaged_msg& e) {
_ecs.get(e.entity).process([&](auto& entity) {
entity.process([&](Player_comp&) { _beat_system.decrease_beats_left(damage_beat_penalty); });
entity.process([&](Player_comp&) {
_beat_system.decrease_beats_left(damage_beat_penalty);
_bus.send<Force_feedback>(static_cast<Input_source>(- 1), 0.075f);
});
});
});
......@@ -42,6 +47,7 @@ namespace phase_shifter::gameplay {
});
_mailbox.subscribe_to([&](Enemy_killed_msg& e) {
_beat_system.increase_beats_left(kill_beat_gain);
_bus.send<Force_feedback>(static_cast<Input_source>(-1), 0.15f);
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment