Space Plunder
Loading...
Searching...
No Matches
AudioReactionComponent.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"
6#include "Components/ActorComponent.h"
7#include "AudioReactionComponent.generated.h"
8
9
10UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent))
11class INTERACTION_API UAudioReactionComponent : public UActorComponent
12{
13 GENERATED_BODY()
14
15public:
16 UAudioReactionComponent();
17 UFUNCTION(BlueprintCallable, Category="Audio")
18 void SetSkeletalMeshComponent(USkeletalMeshComponent* Mesh);
19
20 virtual void SetActive(bool bNewActive, bool bReset = false) override;
21
22protected:
23 virtual void BeginPlay() override;
24
25 UFUNCTION(BlueprintCallable, Category="Audio")
26 void OnHit(AActor* SelfActor, AActor* OtherActor, FVector NormalImpulse, const FHitResult& Hit);
27
28 UFUNCTION(BlueprintCallable, Category="Audio")
29 void PlayHitSound(const float Volume, const FVector& HitLocation);
30
31 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
32 TSoftObjectPtr<USoundBase> ImpactSound;
33
34 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
35 float PitchMultiplier = 1.0f;
36 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
37 float VolumeMultiplier = 1.0f;
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
39 bool bDebuggingMode = false;
40
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
42 float VelocityThreshold = 250.0f;
43 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
44 float OtherActorVelocityThreshold = 500.0f;
45
46 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
47 float MaxVolumeVelocity = 5000.0f;
49 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
50 float AudioPlayDelay = 0.2f;
51 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
52 float MaxAudioVolume = 1.2f;
53 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Audio")
54 class UAudioComponent* ImpactAudioComponent = nullptr;
55 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
56 bool bAddDurationToDelay = false;
57
58
59 UPROPERTY(VisibleAnywhere, Category="Audio")
60 bool bIsCharacter = false;
61 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
62 bool bUseOneBodyPart = false;
63 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
64 FName MainBodyPartName = FName("Pelvis");
65 UFUNCTION(BlueprintCallable, Category="Audio")
66 float GetMainBodyPartVelocity(const USkeletalMeshComponent* SkeletalMesh, const FName BoneName) const;
67 UFUNCTION(BlueprintCallable, Category="Audio")
68 float CalculateRagdollVelocity(USkeletalMeshComponent* SkeletalMesh) const;
69private:
70 UFUNCTION()
71 void SoundHitDelay();
72
73 UPROPERTY(VisibleAnywhere, Category="Audio")
74 bool bIsHitPlaying = false;
75
76 UPROPERTY(VisibleAnywhere, Category="Audio")
77 class USkeletalMeshComponent* SkeletalMeshComponent = nullptr;
78
79 FTimerHandle HitPlayingTimerHandle;
80
81};
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13