LEAP Documentation 40220
Documentation for the LEAP project
AssaultPointDestructible.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "GameFramework/Actor.h"
7#include "TeamInterface.h"
8#include "HealthInterface.h"
10#include "AssaultPointDestructible.generated.h"
11
12class UPrimitiveComponent;
13class UInteractableComponent;
15class UAfflictionInstance;
17
18USTRUCT(BlueprintType)
20{
21 GENERATED_USTRUCT_BODY()
23 UPROPERTY(BlueprintReadOnly)
24 bool bBombActive = false;
25 UPROPERTY(BlueprintReadOnly)
26 float BombPlaceTime = 0.0f;
27 UPROPERTY(BlueprintReadOnly)
28 TWeakObjectPtr<AProjectXPlayerState> Planter;
29};
30
32DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FAssaultPointDestructibleHealthSignature, float, Health, float, MaxHealth);
33DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FBombUpdatedSignature, AAssaultPointDestructible*, DestructiblePoint, FBombInfo, BombInfo);
34
35UCLASS()
36class PROJECTX_API AAssaultPointDestructible : public AActor, public ITeamInterface, public IInteractableInterface
37{
38 GENERATED_BODY()
39
40public:
42 UFUNCTION(BlueprintPure)
43 bool IsDestroyed() const;
44 virtual int32 GetTeam() const override { return TeamOwner; }
45 UFUNCTION(BlueprintPure)
46 const FBombInfo& GetBombInfo() const { return BombInfo; }
47 UFUNCTION(BlueprintPure)
48 FORCEINLINE bool IsBombPlanted() const { return BombInfo.bBombActive; }
49 UFUNCTION(BlueprintPure)
50 FORCEINLINE float GetFuseTime() const { return BombFuseTime; }
51 UFUNCTION(BlueprintPure)
52 FORCEINLINE bool IsActivePoint() const { return bActive; }
53 virtual void DestroyPoint();
54 virtual int32 SetTeam(int32 NewTeam) override;
55
56 UPROPERTY(BlueprintAssignable)
57 FAssaultPointDestructibleSignature OnDestructibleDestroyedEvent;
58 UPROPERTY(BlueprintAssignable)
59 FAssaultPointDestructibleHealthSignature OnDamageTaken;
60 UPROPERTY(BlueprintAssignable)
61 FBombUpdatedSignature OnBombStateUpdated;
62
63 void ToggleActive(bool bNewActiveState);
64
65 virtual FText GetHighlightText(const UPrimitiveComponent* Component, const APlayerController* EventSender) const override;
66 virtual bool CanBeInteractedWith(const UPrimitiveComponent* Component, const APlayerController* EventSender) const override;
67
68protected:
69 UFUNCTION(NetMulticast,UnReliable)
70 void Multicast_DestroyPoint();
71
72 UFUNCTION()
73 void OnSelected(APlayerController* Sender, UPrimitiveComponent* Component);
74 UFUNCTION()
75 void OnHoldStopped(APlayerController* Sender, UPrimitiveComponent* Component);
76 UFUNCTION()
77 void OnHoldStarted(APlayerController* Sender, UPrimitiveComponent* Component);
78 UFUNCTION()
79 void OnValidInteractionTargetUpdated(APlayerController* Sender, bool bValidInteraction);
80
81 void PlantBomb(AProjectXCharacter* Planter);
82 void DisarmBomb(AProjectXCharacter* Disarmer);
83
84 UFUNCTION()
85 void OnRep_Destroyed();
86 UFUNCTION()
87 void OnRep_Team();
88 UFUNCTION(BlueprintImplementableEvent)
89 void OnDestructibleDestroyed();
90 UFUNCTION(BlueprintImplementableEvent)
91 void OnTeamUpdated(int32 NewTeam);
92 UFUNCTION()
93 void OnRep_BombInfo();
94
95 UPROPERTY(EditDefaultsOnly, Category = Interactable)
96 TSubclassOf<UAfflictionInstance> InteractionAffliction;
97 /* Text to show when planting*/
98 UPROPERTY(EditDefaultsOnly, Category = Interactable)
99 FText BombPlantText = FText();
100 /* Text to show when Disarming*/
101 UPROPERTY(EditDefaultsOnly, Category = Interactable)
102 FText BombDisarmText = FText();
103
104 UPROPERTY(ReplicatedUsing = OnRep_Team)
105 int32 TeamOwner = 0;
106 UPROPERTY(ReplicatedUsing = OnRep_Destroyed)
107 bool bDestroyed = false;
108 UPROPERTY(Replicated)
109 bool bActive = false;
110 UPROPERTY(EditDefaultsOnly, Category = Bomb)
111 float BombFuseTime = 10.0f;
112 UPROPERTY(ReplicatedUsing = OnRep_BombInfo)
113 FBombInfo BombInfo;
114
115 FTimerHandle BombFuseTimer;
116
117 UPROPERTY(EditDefaultsOnly)
118 UInteractableComponent* InteractableComponent;
119};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FAssaultPointDestructibleHealthSignature, float, Health, float, MaxHealth)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FAssaultPointDestructibleSignature, AAssaultPointDestructible *, Point)
Definition: AssaultPointDestructible.h:37
virtual int32 GetTeam() const override
Definition: AssaultPointDestructible.h:44
Definition: ProjectXCharacter.h:128
Definition: ProjectXPlayerState.h:238
virtual void OnRep_Team()
Definition: ProjectXPlayerState.cpp:1789
int32 SetTeam(int32 NewTeam) override
Definition: ProjectXPlayerState.cpp:1592
Definition: InteractableInterface.h:18
Definition: TeamInterface.h:26
Definition: AssaultPointDestructible.h:20
bool bBombActive
Definition: AssaultPointDestructible.h:24