Commit 1b0fdeda authored by Tim Scheiber's avatar Tim Scheiber
Browse files

minor fixes

parent 042663dc
{
// Informationen zu dieser Datei finden Sie unter https://go.microsoft.com//fwlink//?linkid=834763.
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
}
]
}
\ No newline at end of file
......@@ -18,7 +18,8 @@
"off_beat_threshold": 0.0
},
"FixedPath": {
"pause_between_steps": 1
"pause_between_steps": 1,
"wait_beats": 1
},
"Shooting": {
"default_orientation": 270,
......
......@@ -13,10 +13,9 @@ namespace phase_shifter::gameplay {
float direction = 0; // angle of direction with 0° beeing North (-Z)
float curvature = 0; // angle of curvature in degrees
unsigned int pause_between_steps = 0; // number of beats the entity waits between steps
unsigned int wait_beats = 0; // number of beats the entity waits before taking the next step
};
sf2_structDef(Continuous_path_comp, direction, curvature, pause_between_steps);
sf2_structDef(Continuous_path_comp, direction, curvature, pause_between_steps, wait_beats);
} // namespace phase_shifter::gameplay
\ No newline at end of file
......@@ -108,8 +108,8 @@ namespace phase_shifter::gameplay {
void Enemy_system::do_shooting(Beat_state& beat)
{
for(auto&& [shooting, transform] :
_entity_manager.list<Shooting_comp, components::Transform_comp>()) {
for(auto&& [entity, shooting, transform] :
_entity_manager.list<Entity_facet, Shooting_comp, components::Transform_comp>()) {
auto my_position = transform.position;
glm::vec3 closest_target_pos;
float closest_dist = 999999999.f;
......@@ -184,6 +184,7 @@ namespace phase_shifter::gameplay {
transform.orientation = glm::rotation(
{0, 0, 1}, glm::vec3(std::sin(rad_orientation), 0, -std::cos(rad_orientation)));
entity.process([&](Movement_comp& movement) { movement.want_orientation = false; });
}
}
......
......@@ -14,7 +14,6 @@ namespace phase_shifter::gameplay {
float next_direction();
unsigned int pause_between_steps = 0; // number of beats the entity waits between steps
unsigned int wait_beats = 0; // number of beats the entity waits before taking the next step
private:
......@@ -23,6 +22,6 @@ namespace phase_shifter::gameplay {
bool reverse = false; //flag wether the path is now traced backwards
};
sf2_structDef(Fixed_path_comp, pause_between_steps);
sf2_structDef(Fixed_path_comp, pause_between_steps, wait_beats);
}
\ No newline at end of file
......@@ -9,11 +9,11 @@ namespace phase_shifter::gameplay {
using Component::Component;
unsigned int pause_between_steps = 0; // number of beats the entity waits between steps
unsigned int wait_beats = 0; // number of beats the entity waits before taking the next step
mirrage::ecs::Entity_handle target;
unsigned int wait_beats = 0; // number of beats the entity waits before taking the next step
};
sf2_structDef(Follow_target_comp, pause_between_steps);
sf2_structDef(Follow_target_comp, pause_between_steps, wait_beats);
} // namespace phase_shifter::gameplay
\ No newline at end of file
......@@ -25,8 +25,9 @@ namespace phase_shifter::gameplay {
glm::vec2 last_step;
glm::vec2 last_aim;
glm::vec2 last_position; // position of the entity during the last frame
bool moved = false;
bool attack = false;
bool moved = false;
bool attack = false;
bool want_orientation = true; // flag whether the movement system shall orientate the entity
};
sf2_structDef(Movement_comp,
......
......@@ -126,10 +126,12 @@ namespace phase_shifter::gameplay {
move.last_aim = look_dir;
look_dir /= look_dir_len;
transform.orientation = glm::normalize(glm::slerp(
transform.orientation,
glm::rotation(glm::vec3{0.f, 0.f, 1.f}, glm::vec3(look_dir.x, 0, look_dir.y)),
std::min(1.f, dt.value() * 10.f)));
if(move.want_orientation) {
transform.orientation = glm::normalize(glm::slerp(
transform.orientation,
glm::rotation(glm::vec3{0.f, 0.f, 1.f}, glm::vec3(look_dir.x, 0, look_dir.y)),
std::min(1.f, dt.value() * 10.f)));
}
}
}
}
......
......@@ -95,7 +95,7 @@ namespace phase_shifter {
.entity_builder("basic_enemy")
.position({20, 0, 15})
.post_create([=](auto entity) {
entity.process([&](gameplay::Fixed_path_comp& fixed_path) { fixed_path.update_path({}); });
entity.process([&](gameplay::Fixed_path_comp& fixed_path) { fixed_path.update_path({180}); });
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}})});
});
......
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