Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Sommersemester 2019
Cpp
PhaseShifter
Commits
f1002aa7
Commit
f1002aa7
authored
Sep 18, 2019
by
Florian Oetke
Browse files
basis for highlevel gameplay
parent
9f93e3d8
Changes
7
Hide whitespace changes
Inline
Side-by-side
assets/game_assets/blueprints/player.json
View file @
f1002aa7
...
...
@@ -13,5 +13,6 @@
"step_time_percentage"
:
0.2
,
"off_beat_threshold"
:
0.2
},
"Input_controller"
:
{}
"Input_controller"
:
{},
"Player"
:
{}
}
src/gameplay/beat_system.cpp
View file @
f1002aa7
...
...
@@ -13,11 +13,12 @@ namespace phase_shifter::gameplay {
_acc
+=
dt
.
value
();
auto
beat
=
_acc
>=
beat_time
;
if
(
beat
)
{
_state
.
beats_left
--
;
LOG
(
plog
::
debug
)
<<
"beat"
;
_acc
=
0
;
}
_state
=
{
beat
,
_acc
,
beat_time
-
_acc
};
_state
=
{
beat
,
_acc
,
beat_time
-
_acc
,
beat_time
,
_state
.
beats_left
};
}
}
// namespace phase_shifter::gameplay
src/gameplay/beat_system.hpp
View file @
f1002aa7
...
...
@@ -9,6 +9,8 @@ namespace phase_shifter::gameplay {
float
time_since_beat
=
0.
f
;
float
time_to_beat
=
0.
f
;
float
avg_beat_time
=
1.
f
;
int
beats_left
=
9999.
f
;
};
// TODO: replace placeholder logic with actual beat detection
...
...
src/gameplay/combat_system.cpp
0 → 100644
View file @
f1002aa7
#include
"combat_system.hpp"
#include
"player_comp.hpp"
namespace
phase_shifter
::
gameplay
{
Combat_system
::
Combat_system
(
mirrage
::
util
::
Message_bus
&
bus
,
mirrage
::
ecs
::
Entity_manager
&
ecs
)
:
_mailbox
(
bus
),
_ecs
(
ecs
)
{
_ecs
.
register_component_type
<
Player_comp
>
();
_mailbox
.
subscribe_to
([
&
](
Damaged_msg
&
e
)
{
_ecs
.
get
(
e
.
entity
).
process
([
&
](
auto
&
entity
)
{
//entity.process<>();
// TODO
});
// TODO
});
}
void
Combat_system
::
update
(
mirrage
::
util
::
Time
)
{
_mailbox
.
update_subscriptions
();
// TODO
}
}
// namespace phase_shifter::gameplay
src/gameplay/combat_system.hpp
0 → 100644
View file @
f1002aa7
#pragma once
#include
<mirrage/ecs/entity_handle.hpp>
#include
<mirrage/utils/messagebus.hpp>
#include
<mirrage/utils/units.hpp>
namespace
mirrage
::
ecs
{
class
Entity_manager
;
}
namespace
phase_shifter
::
gameplay
{
struct
Damaged_msg
{
mirrage
::
ecs
::
Entity_handle
entity
;
};
class
Combat_system
{
public:
Combat_system
(
mirrage
::
util
::
Message_bus
&
,
mirrage
::
ecs
::
Entity_manager
&
);
void
update
(
mirrage
::
util
::
Time
);
private:
mirrage
::
util
::
Mailbox_collection
_mailbox
;
mirrage
::
ecs
::
Entity_manager
&
_ecs
;
};
}
// namespace phase_shifter::gameplay
src/gameplay/player_comp.cpp
0 → 100644
View file @
f1002aa7
#include
"player_comp.hpp"
src/gameplay/player_comp.hpp
0 → 100644
View file @
f1002aa7
#pragma once
#include
<mirrage/ecs/ecs.hpp>
#include
<mirrage/utils/sf2_glm.hpp>
#include
<mirrage/utils/units.hpp>
namespace
phase_shifter
::
gameplay
{
struct
Player_comp
:
public
mirrage
::
ecs
::
Stateless_tag_component
<
Player_comp
>
{
static
constexpr
const
char
*
name
()
{
return
"Player"
;
}
using
Stateless_tag_component
::
Stateless_tag_component
;
};
}
// namespace phase_shifter::gameplay
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment