Space Plunder
Loading...
Searching...
No Matches
PhysicalHitReactionsComponent.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"
8#include "Data/HealthData.h"
9#include "PhysicalHitReactionsComponent.generated.h"
10
11
21UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent) )
23{
24 GENERATED_BODY()
25
26public:
28
29 virtual void ComponentSetupComplete() override;
30
31 //@TODO add to character Component
32 UFUNCTION(BlueprintCallable, Category="Hit Reactions")
33 void SetDisabled(const bool Disable = true){bDisabled = Disable;};
34
35 UFUNCTION(BlueprintCallable, Category="Hit Reactions")
36 void HitReaction(const FName& BoneHit, const FVector& HitVector, const float Multiplier = 1);
37 UFUNCTION(BlueprintCallable, Category="Hit Reactions")
38 void TogglePhysicalAnimation(const bool bTurnOn = true, const EBodyPartName BodyPartName = EBodyPartName::Spine, const EPhysicalBodyStrength Strength = EPhysicalBodyStrength::Strong) const;
39 UFUNCTION()
40 void SetStrengthMultiplier(float Strength);
41
42 //- Bind from Health //
43 UFUNCTION(BlueprintCallable, Category="Hit Reactions")
44 void OnInjuredBodyPart(const EBodyPartName InjuredBodyPart, const FVector& HitLocation, const TArray<FBodyPart>& AllBodyParts);
45 UFUNCTION(BlueprintCallable, Category="Hit Reactions")
46 void TakeHit(const float Damage, const FVector& HitLocation, const FName& BoneName, const FVector& ShotFromDirection, const UDamageType* DamageType);
47 UFUNCTION(NetMulticast, Unreliable, BlueprintCallable, Category="Hit Reactions")
48 void MulticastTakeHit(const float Damage, const FVector& HitLocation, const FName& BoneName, const FVector& ShotFromDirection, const UDamageType* DamageType);
49
50 virtual void OwnerDeath() override;
51
52protected:
53
54 virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
55 // UFUNCTION()
56 // virtual void TakePointDamage(AActor* DamagedActor, float Damage, class AController* InstigatedBy, FVector HitLocation, class UPrimitiveComponent* FHitComponent, FName BoneName, FVector ShotFromDirection, const class UDamageType* DamageType, AActor* DamageCauser);
57
58 UPROPERTY(BlueprintReadOnly, Category="Hit Reactions")
59 class UPhysicalAnimationComponent* PhysicalAnimationComponent;
60
61 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Reactions")
62 float MaxFloppyTime = 1.5f;
63 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Reactions")
64 float CounterMultiplier = 0.05f;
65 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Reactions", meta=(ClampMin="0.1", ClampMax="20.0"))
66 float ImpulseMultiplier = 10.0f;
67 //- How much Damage Has to be done for it to move that character //
68 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Reactions")
69 float BlendTimeMultiplier = 10.0f;
70
71 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Reactions")
72 FName ProfileStrong = "Strong";
73 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Reactions")
74 FName ProfileMid = "Mid";
75 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Reactions")
76 FName ProfileWeak = "Weak";
77 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Reactions")
78 FName ProfileRagdoll = "Ragdoll";
79
80private:
81 void PhysicalReaction();
82
83
84 bool bDisabled = false;
85 const FName Pelvis = "Pelvis";
86 const FName Spine = "Spine_01";
87
88
89 float InterpFloat;
90 float HitReactionTimeRemaining = 0.0f;
91 float Counter = 0.0f;
92 FTimerHandle ReactionLengthTimer;
93
94 FVector LastHitVector = FVector::ZeroVector;
95 FName LastHitBone = Spine;
96 float LastMultiplier = 1.0f;
97
98};
EBodyPartName
Definition BaseData.h:133
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
EPhysicalBodyStrength
Definition HealthData.h:17
Represents a character component that can be added to an actor.
This component handles physical hit reactions for a character.
Definition HealthData.h:26