some SFX
This commit is contained in:
@@ -16,6 +16,9 @@ public partial class HeadSystem : Node3D
|
||||
[Signal]
|
||||
public delegate void GotHitEventHandler();
|
||||
|
||||
[Signal]
|
||||
public delegate void StepFootEventHandler();
|
||||
|
||||
public record CameraParameters(
|
||||
double Delta,
|
||||
Vector2 LookDir,
|
||||
@@ -144,6 +147,8 @@ public partial class HeadSystem : Node3D
|
||||
EmitSignalHitboxDeactivated();
|
||||
}
|
||||
|
||||
private bool _footstepEmitted;
|
||||
|
||||
public void LookAround(CameraParameters inputs)
|
||||
{
|
||||
var (delta,
|
||||
@@ -206,6 +211,9 @@ public partial class HeadSystem : Node3D
|
||||
// creating bobbing effect. The same works for cos. As the _bobbingAccumulator increases the cos decreases and then increases
|
||||
newPositionForCamera.Y = Mathf.Sin(_bobbingAccumulator * BobbingFrequency) * BobbingAmplitude * bobbingMultiplier;
|
||||
newPositionForCamera.X = Mathf.Cos(_bobbingAccumulator * BobbingFrequency / 2.0f) * BobbingAmplitude * bobbingMultiplier;
|
||||
|
||||
if (newPositionForCamera.Y < -0.07 && !_footstepEmitted) Footstep();
|
||||
if (newPositionForCamera.Y > 0) _footstepEmitted = false;
|
||||
|
||||
// Offset bobbing for weapon rig
|
||||
newPositionForRig.Y = Mathf.Cos(_bobbingAccumulator * BobbingFrequency) * BobbingAmplitude * bobbingMultiplier * 0.2f;
|
||||
@@ -261,6 +269,12 @@ public partial class HeadSystem : Node3D
|
||||
_camera.Fov = Mathf.Lerp(_camera.Fov, targetFov, (float) delta * FovChangeSpeed);
|
||||
}
|
||||
|
||||
public void Footstep()
|
||||
{
|
||||
_footstepEmitted = true;
|
||||
EmitSignalStepFoot();
|
||||
}
|
||||
|
||||
public void HideWeapon()
|
||||
{
|
||||
_fpRig.Visible = false;
|
||||
|
||||
@@ -302,7 +302,7 @@ tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0.00011616433), Vector3(-1.0471976, 0, 0), Vector3(0, 0, 0)]
|
||||
"values": [Vector3(0, 0, 0.00011616433), Vector3(-0.5235988, 0, 0), Vector3(0, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_0hyrq"]
|
||||
|
||||
Reference in New Issue
Block a user