Space Plunder
Loading...
Searching...
No Matches
FootstepFXHandler.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "FootstepFXHandler.generated.h"
9
10class UNiagaraSystem;
11
12USTRUCT(BlueprintType)
14{
16
17 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
18 TSoftObjectPtr<UNiagaraSystem> Dirt;
19
20 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
21 TSoftObjectPtr<UNiagaraSystem> General01;
22
23 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
24 TSoftObjectPtr<UNiagaraSystem> General02;
25
26 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
27 TSoftObjectPtr<UNiagaraSystem> Grass;
28
29 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
30 TSoftObjectPtr<UNiagaraSystem> Gravel;
31
32 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
33 TSoftObjectPtr<UNiagaraSystem> Ice;
34
35 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
36 TSoftObjectPtr<UNiagaraSystem> Leaves;
37
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
39 TSoftObjectPtr<UNiagaraSystem> Mud;
40
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
42 TSoftObjectPtr<UNiagaraSystem> Sand;
43
44 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
45 TSoftObjectPtr<UNiagaraSystem> SnowHeavy;
46
47 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
48 TSoftObjectPtr<UNiagaraSystem> SnowLight;
49
50 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
51 TSoftObjectPtr<UNiagaraSystem> Sparks;
52
53 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
54 TSoftObjectPtr<UNiagaraSystem> SpecialAbility;
55
56 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
57 TSoftObjectPtr<UNiagaraSystem> WaterHeavy;
58
59 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
60 TSoftObjectPtr<UNiagaraSystem> WaterLight;
61
62 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
63 TSoftObjectPtr<UNiagaraSystem> Carpet;
64
65 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
66 TSoftObjectPtr<UNiagaraSystem> Concrete;
67
68 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
69 TSoftObjectPtr<UNiagaraSystem> Metal;
70
71 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
72 TSoftObjectPtr<UNiagaraSystem> Plastic;
73
74 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
75 TSoftObjectPtr<UNiagaraSystem> Wood;
76
77 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
78 TSoftObjectPtr<UNiagaraSystem> Flesh;
79
80};
81
82
83UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
84class FOOTSTEPFXCOMPONENT_API UFootstepFXHandler : public UCharacterComponent, public IFootstepInterface
85{
86 GENERATED_BODY()
87
88public:
89 UFootstepFXHandler();
90
91 virtual void PlayFootstepSoundEvent(const bool bRightFoot = false, const float VolumeMultiplier = 1.0f, const float PitchMultiplier = 1.0f) override;
92 virtual void PlayFootstepVFXEvent(const int32 FloorType, const float Speed, const bool bRightFoot, const float Multiplier = 1.0f);
93
94 UFUNCTION(BlueprintCallable, Category = "Footsteps")
95 void PlayJumpSoundEvent(const bool bRightFoot, const bool bJumpStart) const;
96
97 //- Footstep Variables //
98 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
99 bool bPlayPerceptionSound = true;
100 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
101 float FootstepPerceptionVolume = 1.0f;
102 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
103 float FootstepPerceptionCrouchMultiplier = 0.3f;
104 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
105 bool bPlaySound = true;
106 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
107 bool bFootstepsPlay = true;
108 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
109 bool bRattlePlay = false;
110 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
111 bool bVoiceJumpPlay = true;
112 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
113 float FootstepsVolume = 5.0f;
114 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
115 float RattleVolume = 1.0f;
116 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
117 float VoiceJumpVolume = 1.0f;
118 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
119 bool bIsMale = true;
120 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
121 bool bPlayVFX = true;
122 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
123 float VFXSize = 1.0f;
125 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
126 float FootstepCooldownTime = 0.2f;
127
128protected:
129
130 virtual void BeginPlay() override;
131 void FootstepVFXSelector(const int32 FloorType, const float Speed, FVector& Scale, UNiagaraSystem*& FootstepParticle) const;
132
133 //Sounds
134 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
135 TSoftObjectPtr<USoundBase> FootstepSFX;
136 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
137 TSoftObjectPtr<USoundBase> JumpStartSFX;
138 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
139 TSoftObjectPtr<USoundBase> JumpEndSFX;
140
141 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
142 FString RightFootSocketName = "ik_foot_r";
143 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
144 FString LeftFootSocketName = "ik_foot_l";
145
146 //VFX
147 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
148 FFootstepsVFX VFX;
149
150
151 //- Put Floor Materials here //
152 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Footsteps")
153 TArray<class UPhysicalMaterial*> Surfaces;
154
155
156private:
157 //- TraceParams for finding Surface below character //
158 FCollisionQueryParams TraceParams;
159 FVector TraceDown;
160
161 void FootstepCooldown();
162
163 //- Components //
164 UPROPERTY()
165 class UAudioComponent* FootstepAudioComponent = nullptr;
166 UPROPERTY()
167 class UAudioComponent* JumpStartAudioComponent = nullptr;
168 UPROPERTY()
169 class UAudioComponent* JumpEndAudioComponent = nullptr;
170
171 UPROPERTY(VisibleAnywhere, Category = "Footsteps")
172 bool bFootstepPlaying = false;
173 FTimerHandle FootstepTimerHandle;
174};
175
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
Definition FootstepInterface.h:16
Represents a character component that can be added to an actor.
Definition FootstepFXHandler.h:14