Space Plunder
Loading...
Searching...
No Matches
PlayerCharacterShootingComponent.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"
7// #include "Interfaces/HitMarkerInterface.h"
8#include "PlayerCharacterShootingComponent.generated.h"
9
10UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent) )
11class WEAPONSYSTEM_API UPlayerCharacterShootingComponent : public UCharacterShootingComponent
12{
13 GENERATED_BODY()
14
15public:
16 UPlayerCharacterShootingComponent();
17
18
19 virtual void OwnerDeath() override;
20
21 UFUNCTION(BlueprintCallable, Category="Weapon System|ADS")
22 virtual FTransform GetAimDownSightSocket();
23 UFUNCTION(BlueprintCallable, Category = "Weapons|ADS")
24 virtual float GetWeaponFOV() const;
25
26 UFUNCTION(BlueprintCallable, Category = "Weapons|ADS")
27 void HitMarker(const AActor* ActorHit, const float Damage, const UDamageType* DamageType, const FName HitBone, const FVector HitLocation, const bool bKillingHit = false, const bool bInjuredPart = false) const;
28
29
30
31protected:
32 virtual void SetupComponentWidgets() override;
33 virtual void ComponentSetupComplete() override;
34 virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
35 virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
36 //- Used for testing, will only update equipped weapon //
37
38
39
40 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System")
41 int32 MaxNumOfWeaponsDisplayed = 2;
42
43
44
45 //- Recoil //
46 virtual void RecoilStart() override;
47 virtual void RecoilStop() override;
48 virtual void RecoilRecoveryStart() override;
49 virtual void RecoilRecoveryTimer() override;
50
51 virtual void RecoilTick(const float DeltaTime) override;
52
53 void ActiveRecoilTick();
54 void ActiveRecoilRecoveryTick();
55 virtual void RecoilTimer() override;
56
57 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
58 bool bUseRecoilTick = false;
59 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
60 bool bUseRecoilVersionB = false;
61 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
62 float RecoilIncrement = 1.0f;
63 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
64 float RecoveryIncrement = 1.0f;
65 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
66 float RecoveryMultiplier = 1.0f;
67 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
68 float RecoilMaxThreshold = 1.0f;
69
71 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
72 float RecoilFullTime = 8.0f;
73
74 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
75 float InterpSpeed = 10.0f;
77 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
78 float FireTimerSpeed = 10.0f;
79 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
80 bool bUseRecoilCurve = true;
81 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
82 float RecoilRecoveryTime = 10.0f;
83 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
84 float RecoilFireRateMultiplier = 2.0f;
85
86 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
87 float RecoilRecoveryAutoTime = 0.1f;
88 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
89 float RecoilRecoveryNegative = 1.0f;
90 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
91 float RecoilRecoveryAutoNegative = 2.0f;
92 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon System|Recoil")
93 float RecoilRecoveryTolerance = 0.1f;
94
95 //- TODO Move into Struct FPlayerRecoil
96 //Control rotation at the start of the recoil
97 UPROPERTY()
98 FRotator RecoilStartRot;
99 UPROPERTY()
100 FRotator RecoilEndRot;
101
102 //Control rotation change due to recoil
103 UPROPERTY()
104 FRotator RecoilDeltaRot;
105 //Control rotation change due to player moving the mouse
106 UPROPERTY()
107 FRotator PlayerDeltaRot;
108 //Temporary variable used in tick
109 UPROPERTY(BlueprintReadWrite)
110 FRotator RecoilDelta;
111
112
113 //- Recoil //
114
115 UPROPERTY(VisibleAnywhere, Category = "Weapon System|Recoil")
116 bool bRecoil;
117 UPROPERTY(VisibleAnywhere, Category = "Weapon System|Recoil")
118 bool bRecoilRecovery;
119 UPROPERTY(VisibleAnywhere, Category = "Weapon System|Recoil")
120 bool bStoreStartRecoilPosition = true;
121
122 UPROPERTY(VisibleAnywhere, Category="Weapon System|Recoil")
123 float CurrentRecoilTime = 0.0f;
124 UPROPERTY(VisibleAnywhere, Category="Weapon System|Recoil")
125 float FullRecoilTime = 0.0f;
126
127 UPROPERTY(VisibleAnywhere, Category="Weapon System|Recoil")
128 float CurrentRecoveryTime = 0.0f;
129
130 FTimerHandle RecoilRecoveryTimerHandle;
131 FTimerHandle FireTimerHandle;
132
133 // FTimerHandle RecoilTimerHandle;
134 FTimerHandle ActiveRecoilRecoveryTimerHandle;
135
136
137
138private:
139 void SetupWeaponWidget();
140 void SetupWeaponCrosshairWidget();
141
142 // - Weapon System Widget Functions Bind //
143 UFUNCTION()
144 void AmmoChanged(const int32 CurrentAmmo, const int32 TotalAmmo);
145 UFUNCTION()
146 void WeaponEquipped(const TArray<FWeaponData_T>& Weapons, int32 Index);
147 UFUNCTION()
148 void WeaponStateChanged(const FPlayerWeaponState& WeaponState);
149 //- Crosshair Widget Function Bind //
150 UFUNCTION()
151 void BulletShot(float RecoilAmount);
152
153
154
155
156
157
158 //- Widgets //
159 UPROPERTY(EditAnywhere, Category="Weapon System|Widgets")
160 TSoftClassPtr<class UUserWidget> WeaponWidgetClass;
161 UPROPERTY(EditAnywhere, Category="Weapon System|Widgets")
162 TSoftClassPtr<class UUserWidget> CrosshairWidgetClass;
163
164 // UPROPERTY()
165 // class UWeaponSystemWidget* WeaponWidget;
166 // UPROPERTY()
167 // class UCrosshairWidget* CrosshairWidget;
168
169 class IWeaponHUDInterface* WeaponHUD;
170 class ICrosshairInterface* Crosshair;
171
172 // void UpdateHUDElement();
173};
174
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
Definition CrosshairInterface.h:20
Definition WeaponHUDInterface.h:18
Component responsible for managing the shooting behavior of a character.
A struct that represents the state of a player's weapon.
Definition WeaponStructs.h:118
Struct representing data of a weapon that changes.
Definition WeaponStructs.h:861