Compare commits
No commits in common. "7b3c2b5b6f3d5ece10a88e90e1cf1c84ffd41374" and "b08b390c6eab5c0f38b72668a900b2ab0f942d9b" have entirely different histories.
7b3c2b5b6f
...
b08b390c6e
|
@ -20,20 +20,11 @@ void PlayerCamera::update_fov() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerCamera::update_offset() {
|
void PlayerCamera::update_offset() {
|
||||||
bool const is_running{ this->body->get_is_running() };
|
|
||||||
if (is_running != this->was_running) {
|
|
||||||
this->was_running = is_running;
|
|
||||||
this->run_bob_time = 0.0;
|
|
||||||
}
|
|
||||||
double wave{ Math::sin(this->run_bob_time) };
|
|
||||||
Vector3 offset{ Vector3{ float(wave), float(Math::abs(wave)), 0 } * this->run_bob_amplitude };
|
|
||||||
if (!is_running) {
|
|
||||||
this->run_bob_time = MIN(this->run_bob_time, this->run_bob_amplitude);
|
|
||||||
offset = offset.lerp(Vector3(), this->run_bob_time / this->run_bob_amplitude);
|
|
||||||
}
|
|
||||||
GETSET(position, {
|
|
||||||
Basis const basis{ get_basis() };
|
Basis const basis{ get_basis() };
|
||||||
position = this->home + basis.get_column(0) * offset.x + basis.get_column(1) * offset.y * 5.0;
|
double wave{ Math::sin(this->time) };
|
||||||
|
Vector3 const offset{ (this->body->get_is_running() ? Vector3{ float(wave), float(Math::abs(wave)), 0 } * 0.025 : Vector3{ 0, 0, 0 }) };
|
||||||
|
GETSET(position, {
|
||||||
|
position = this->home + basis.get_column(0) * offset.x + basis.get_column(1) * offset.y;
|
||||||
});
|
});
|
||||||
for (Variant child : get_children()) {
|
for (Variant child : get_children()) {
|
||||||
Node3D *child_3d{ cast_to<Node3D>(child) };
|
Node3D *child_3d{ cast_to<Node3D>(child) };
|
||||||
|
@ -52,7 +43,7 @@ void PlayerCamera::ready() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerCamera::process(double delta) {
|
void PlayerCamera::process(double delta) {
|
||||||
this->run_bob_time += delta * this->run_bob_frequency;
|
this->time += delta * 10.;
|
||||||
update_offset();
|
update_offset();
|
||||||
this->fov_factor = 1.0;
|
this->fov_factor = 1.0;
|
||||||
update_fov();
|
update_fov();
|
||||||
|
|
|
@ -26,11 +26,8 @@ private:
|
||||||
float base_fov{ 60.f };
|
float base_fov{ 60.f };
|
||||||
float fov_factor{ 1.0f };
|
float fov_factor{ 1.0f };
|
||||||
Vector3 home{ 0, 0, 0 };
|
Vector3 home{ 0, 0, 0 };
|
||||||
|
double time{ 0.0 };
|
||||||
PlayerBody *body{ nullptr };
|
PlayerBody *body{ nullptr };
|
||||||
bool was_running{ false };
|
|
||||||
double run_bob_time{ 0.0 };
|
|
||||||
double run_bob_amplitude{ 0.025 };
|
|
||||||
double run_bob_frequency{ 10.0 };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !PLAYER_CAMERA_H
|
#endif // !PLAYER_CAMERA_H
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
[sub_resource type="GDScript" id="GDScript_qot2n"]
|
[sub_resource type="GDScript" id="GDScript_qot2n"]
|
||||||
script/source = "extends EnemyWretched
|
script/source = "extends EnemyWretched
|
||||||
|
|
||||||
@export var difficulty_weight : float = 10
|
@export var difficulty_weight : float = 0.25
|
||||||
|
|
||||||
func _on_health_status_death() -> void:
|
func _on_health_status_death() -> void:
|
||||||
%StateMachine.process_mode = Node.PROCESS_MODE_DISABLED
|
%StateMachine.process_mode = Node.PROCESS_MODE_DISABLED
|
||||||
|
@ -13,7 +13,7 @@ func _on_health_status_death() -> void:
|
||||||
$wretched/AnimationPlayer.play(\"death\")
|
$wretched/AnimationPlayer.play(\"death\")
|
||||||
$CollisionShape3D.disabled = true
|
$CollisionShape3D.disabled = true
|
||||||
set_movement_direction(Vector2())
|
set_movement_direction(Vector2())
|
||||||
get_unit().region.raise_difficulty(1.0 / difficulty_weight)
|
get_unit().region.raise_difficulty(difficulty_weight)
|
||||||
"
|
"
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ng1ul"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ng1ul"]
|
||||||
|
|
Loading…
Reference in a new issue