|
|
|
|
| #pragma once
|
|
|
| #include "Components/ControllerComponent.h"
|
| #include "GameplayTagContainer.h"
|
|
|
| #include "LyraWeaponStateComponent.generated.h"
|
|
|
| class UObject;
|
| struct FFrame;
|
| struct FGameplayAbilityTargetDataHandle;
|
| struct FGameplayEffectContextHandle;
|
| struct FHitResult;
|
|
|
|
|
|
|
| struct FLyraScreenSpaceHitLocation
|
| {
|
|
|
| FVector2D Location;
|
| FGameplayTag HitZone;
|
| bool bShowAsSuccess = false;
|
| };
|
|
|
| struct FLyraServerSideHitMarkerBatch
|
| {
|
| FLyraServerSideHitMarkerBatch() { }
|
|
|
| FLyraServerSideHitMarkerBatch(uint8 InUniqueId) :
|
| UniqueId(InUniqueId)
|
| { }
|
|
|
| TArray<FLyraScreenSpaceHitLocation> Markers;
|
|
|
| uint8 UniqueId = 0;
|
| };
|
|
|
|
|
| UCLASS()
|
| class ULyraWeaponStateComponent : public UControllerComponent
|
| {
|
| GENERATED_BODY()
|
|
|
| public:
|
|
|
| ULyraWeaponStateComponent(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
|
|
|
| virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
|
|
| UFUNCTION(Client, Reliable)
|
| void ClientConfirmTargetData(uint16 UniqueId, bool bSuccess, const TArray<uint8>& HitReplaces);
|
|
|
| void AddUnconfirmedServerSideHitMarkers(const FGameplayAbilityTargetDataHandle& InTargetData, const TArray<FHitResult>& FoundHits);
|
|
|
|
|
| void UpdateDamageInstigatedTime(const FGameplayEffectContextHandle& EffectContext);
|
|
|
|
|
| void GetLastWeaponDamageScreenLocations(TArray<FLyraScreenSpaceHitLocation>& WeaponDamageScreenLocations)
|
| {
|
| WeaponDamageScreenLocations = LastWeaponDamageScreenLocations;
|
| }
|
|
|
|
|
| double GetTimeSinceLastHitNotification() const;
|
|
|
| int32 GetUnconfirmedServerSideHitMarkerCount() const
|
| {
|
| return UnconfirmedServerSideHitMarkers.Num();
|
| }
|
|
|
| protected:
|
|
|
|
|
|
|
| virtual bool ShouldShowHitAsSuccess(const FHitResult& Hit) const;
|
|
|
| virtual bool ShouldUpdateDamageInstigatedTime(const FGameplayEffectContextHandle& EffectContext) const;
|
|
|
| void ActuallyUpdateDamageInstigatedTime();
|
|
|
| private:
|
|
|
| double LastWeaponDamageInstigatedTime = 0.0;
|
|
|
|
|
| TArray<FLyraScreenSpaceHitLocation> LastWeaponDamageScreenLocations;
|
|
|
|
|
| TArray<FLyraServerSideHitMarkerBatch> UnconfirmedServerSideHitMarkers;
|
| };
|
|
|