Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
PhaseShifter
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GameDevWeek
S
Sommersemester 2019
Cpp
PhaseShifter
Commits
f1002aa7
Commit
f1002aa7
authored
Sep 18, 2019
by
Florian Oetke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basis for highlevel gameplay
parent
9f93e3d8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
2 deletions
+79
-2
assets/game_assets/blueprints/player.json
assets/game_assets/blueprints/player.json
+2
-1
src/gameplay/beat_system.cpp
src/gameplay/beat_system.cpp
+2
-1
src/gameplay/beat_system.hpp
src/gameplay/beat_system.hpp
+2
-0
src/gameplay/combat_system.cpp
src/gameplay/combat_system.cpp
+28
-0
src/gameplay/combat_system.hpp
src/gameplay/combat_system.hpp
+29
-0
src/gameplay/player_comp.cpp
src/gameplay/player_comp.cpp
+1
-0
src/gameplay/player_comp.hpp
src/gameplay/player_comp.hpp
+15
-0
No files found.
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
Markdown
is supported
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