Compare commits
2 commits
b08b390c6e
...
7b3c2b5b6f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7b3c2b5b6f | ||
![]() |
793391f0d3 |
|
@ -20,11 +20,20 @@ void PlayerCamera::update_fov() {
|
|||
}
|
||||
|
||||
void PlayerCamera::update_offset() {
|
||||
Basis const basis{ get_basis() };
|
||||
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 }) };
|
||||
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, {
|
||||
position = this->home + basis.get_column(0) * offset.x + basis.get_column(1) * offset.y;
|
||||
Basis const basis{ get_basis() };
|
||||
position = this->home + basis.get_column(0) * offset.x + basis.get_column(1) * offset.y * 5.0;
|
||||
});
|
||||
for (Variant child : get_children()) {
|
||||
Node3D *child_3d{ cast_to<Node3D>(child) };
|
||||
|
@ -43,7 +52,7 @@ void PlayerCamera::ready() {
|
|||
}
|
||||
|
||||
void PlayerCamera::process(double delta) {
|
||||
this->time += delta * 10.;
|
||||
this->run_bob_time += delta * this->run_bob_frequency;
|
||||
update_offset();
|
||||
this->fov_factor = 1.0;
|
||||
update_fov();
|
||||
|
|
|
@ -26,8 +26,11 @@ private:
|
|||
float base_fov{ 60.f };
|
||||
float fov_factor{ 1.0f };
|
||||
Vector3 home{ 0, 0, 0 };
|
||||
double time{ 0.0 };
|
||||
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
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
[sub_resource type="GDScript" id="GDScript_qot2n"]
|
||||
script/source = "extends EnemyWretched
|
||||
|
||||
@export var difficulty_weight : float = 0.25
|
||||
@export var difficulty_weight : float = 10
|
||||
|
||||
func _on_health_status_death() -> void:
|
||||
%StateMachine.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
|
@ -13,7 +13,7 @@ func _on_health_status_death() -> void:
|
|||
$wretched/AnimationPlayer.play(\"death\")
|
||||
$CollisionShape3D.disabled = true
|
||||
set_movement_direction(Vector2())
|
||||
get_unit().region.raise_difficulty(difficulty_weight)
|
||||
get_unit().region.raise_difficulty(1.0 / difficulty_weight)
|
||||
"
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ng1ul"]
|
||||
|
|
Loading…
Reference in a new issue