Add basic implementation for footsteps
Add disengage to eden pillar Fix level up sound effect trigger
This commit is contained in:
@@ -52,6 +52,7 @@ public class ExperiencePointsComponent : IExperiencePointsComponent
|
||||
|
||||
public void LevelUp()
|
||||
{
|
||||
SfxDatabase.Instance.Play(SoundEffect.LevelUp);
|
||||
_level.OnNext(_level.Value + 1);
|
||||
var expToNextLevel = ExpToNextLevelCalculation(_level.Value);
|
||||
_currentExp.OnNext(_currentExp.Value - _expToNextLevel.Value);
|
||||
|
||||
@@ -12,8 +12,8 @@ dest_files=["res://.godot/imported/player_steps_concrete.ogg-2210939b45b35c9b2fc
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
loop=true
|
||||
loop_offset=0.0
|
||||
bpm=0.0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=16 format=3 uid="uid://cmvimr0pvsgqy"]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://cmvimr0pvsgqy"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d2m7esc5ypl7y" path="res://src/enemy/enemy_types/10. Eden Pillar/EdenPillar.cs" id="1_p8jc1"]
|
||||
[ext_resource type="PackedScene" uid="uid://cktycana6xxtp" path="res://src/enemy/enemy_types/10. Eden Pillar/EdenPillarModelView.tscn" id="3_o285m"]
|
||||
@@ -27,6 +27,9 @@ radius = 0.886719
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_xdeci"]
|
||||
radius = 7.98633
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_t4xb3"]
|
||||
radius = 20.0
|
||||
|
||||
[node name="Eden Pillar" type="CharacterBody3D"]
|
||||
collision_layer = 10
|
||||
collision_mask = 0
|
||||
@@ -131,3 +134,11 @@ collision_mask = 32
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerDetector"]
|
||||
shape = SubResource("CylinderShape3D_xdeci")
|
||||
|
||||
[node name="LoseTrackOfPlayer" type="Area3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
collision_layer = 0
|
||||
collision_mask = 32
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="LoseTrackOfPlayer"]
|
||||
shape = SubResource("CylinderShape3D_t4xb3")
|
||||
|
||||
@@ -38,6 +38,8 @@ public partial class EdenPillar : Enemy3D, IHasPrimaryAttack, IHasSecondaryAttac
|
||||
|
||||
[Node] public Area3D PlayerDetector { get; set; } = default!;
|
||||
|
||||
[Node] public Area3D LoseTrackOfPlayer { get; set; } = default!;
|
||||
|
||||
[Node] public EngagePlayerBehavior EngagePlayerBehavior { get; set; } = default!;
|
||||
|
||||
|
||||
@@ -50,10 +52,13 @@ public partial class EdenPillar : Enemy3D, IHasPrimaryAttack, IHasSecondaryAttac
|
||||
public void OnReady()
|
||||
{
|
||||
PlayerDetector.BodyEntered += PlayerDetector_BodyEntered;
|
||||
LoseTrackOfPlayer.BodyExited += LoseTrackOfPlayer_BodyExited;
|
||||
EngagePlayerBehavior.TakeAction += PerformAction;
|
||||
HealthComponent.HealthReachedZero += HealthComponent_HealthReachedZero;
|
||||
}
|
||||
|
||||
private void LoseTrackOfPlayer_BodyExited(Node3D body) => EngagePlayerBehavior.Disengage();
|
||||
|
||||
private void HealthComponent_HealthReachedZero()
|
||||
{
|
||||
StoneRotation.Stop();
|
||||
|
||||
@@ -81,6 +81,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
[Node] private Timer HealthTimer { get; set; } = default!;
|
||||
|
||||
[Node] private RigidBody3D WallCheck { get; set; } = default!;
|
||||
|
||||
[Node] private AudioStreamPlayer3D WalkSFX { get; set; } = default!;
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -207,7 +209,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
var hpIncrease = rng.RandiRange(3, 6);
|
||||
HealthComponent.RaiseMaximumHP(hpIncrease);
|
||||
ExperiencePointsComponent.LevelUp();
|
||||
SfxDatabase.Instance.Play(SoundEffect.LevelUp);
|
||||
}
|
||||
|
||||
public void Die()
|
||||
@@ -324,6 +325,10 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
_knockbackStrength *= 0.9f;
|
||||
Transform = Transform with { Basis = transform.Basis };
|
||||
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
|
||||
if (!WalkSFX.Playing && !Velocity.IsZeroApprox())
|
||||
WalkSFX.Play();
|
||||
else if (Velocity.IsZeroApprox())
|
||||
WalkSFX.Stop();
|
||||
MoveAndSlide();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=54 format=3 uid="uid://cfecvvav8kkp6"]
|
||||
[gd_scene load_steps=55 format=3 uid="uid://cfecvvav8kkp6"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://yxmiqy7i0t7r" path="res://src/player/Player.cs" id="1_xcol5"]
|
||||
[ext_resource type="AudioStream" uid="uid://cth2xgoqhdf0m" path="res://src/audio/sfx/player_hit_wall.ogg" id="3_565yv"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4ps26w7h3vpq" path="res://src/minimap/textures/player_map_icon.png" id="4_3ojaj"]
|
||||
[ext_resource type="Texture2D" uid="uid://2ig1arptr1e8" path="res://src/vfx/Items Etc/slash_2.png" id="4_v7rlw"]
|
||||
[ext_resource type="Texture2D" uid="uid://qhxl3nejqlk1" path="res://src/vfx/World/DUST_1.png" id="5_v5qoq"]
|
||||
[ext_resource type="AudioStream" uid="uid://bsprdc3ka6am0" path="res://src/audio/sfx/player_steps_concrete.ogg" id="6_v7rlw"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dw45s"]
|
||||
radius = 1.0
|
||||
@@ -631,3 +632,7 @@ animation = &"sample"
|
||||
[node name="HitWallSound" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
bus = &"SFX"
|
||||
|
||||
[node name="WalkSFX" type="AudioStreamPlayer3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("6_v7rlw")
|
||||
|
||||
Reference in New Issue
Block a user