LEAP Documentation 40220
Documentation for the LEAP project
CommandCenter.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2021. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "CommandCenter.generated.h"
9
10DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCommandCenterEventSignature, class ACommandCenter*, CommandCenter);
11DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FCommandCenterHealthEventSignature, class ACommandCenter*, CommandCenter, float, Delta);
17
18UCLASS()
20{
21 GENERATED_BODY()
22
23public:
25
26 virtual void BeginPlay() override;
27 virtual void DefensesDepleted();
28 virtual void DestroyCommandCenter();
29
30 virtual float GetObjectiveHealth() const override;
31 virtual float GetObjectiveMaxHealth() const override;
32 virtual bool GetIsObjectiveDead() const { return PartsAlive <= 0; }
33 virtual int32 GetObjectiveTeam() const { return GetTeam(); }
34 virtual int32 GetObjectiveSortOrder() const { return SortOrder; }
35 virtual bool GetIsObjectiveProperlyInitialized() const { return bIsProperlyInitialized; }
36
37 UFUNCTION(BlueprintPure, Category = "Command Center")
38 bool HasDefensesUp() const;
39
40 UFUNCTION()
41 virtual void OnPartDamageTaken(ADestroyableObjective* Objective, const float Damage, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser, class APlayerState* InstigatorPlayerState);
42 UFUNCTION()
43 virtual void OnPartDestroyed(ADestroyableObjective* Objective, const float Damage, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser, class APlayerState* InstigatorPlayerState);
44 UFUNCTION()
45 virtual void OnPartActivationChanged(ADestroyableObjective* Objective);
46
47 UPROPERTY(BlueprintAssignable, Category = "Command Center Events")
48 FCommandCenterEventSignature OnCommandCenterDestroyed;
49 UPROPERTY(BlueprintAssignable, Category = "Command Center Events")
50 FCommandCenterEventSignature OnCommandCenterUnderAttack;
51 UPROPERTY(BlueprintAssignable, Category = "Command Center Events")
52 FCommandCenterHealthEventSignature OnCommandCenterHealthChanged;
53 UPROPERTY(BlueprintAssignable, Category = "Command Center Events")
54 FCommandCenterEventSignature OnDefensesDepleted;
55 UPROPERTY(BlueprintAssignable, Category = "Command Center Events")
56 FCommandCenterEventSignature OnCommandCenterProperlyInitialized;
57
58protected:
59 UFUNCTION()
60 virtual void CheckForInitialization();
61 UFUNCTION(BlueprintImplementableEvent)
62 void OnCommandCenterInitialized();
63
64 // The damageable parts that make this Command Center
65 UPROPERTY(EditInstanceOnly, Category = "Command Center")
66 TArray<ADestroyableObjective*> DestroyableParts;
67 // The autonomous turrets assigned to defend this Command Center
68 UPROPERTY(EditInstanceOnly, Category = "Command Center")
69 TArray<ADeployableAutonomousTurret*> DefensiveTurrets;
70
71 /* Determines what order the points will display on the HUD */
72 UPROPERTY(EditInstanceOnly, Category = "Command Center", meta = (AllowPrivateAccess = true))
73 int32 SortOrder = INDEX_NONE;
74
75 UFUNCTION()
76 virtual void OnHealthChanged(float Delta);
77
78private:
79 // The parts that are still alive
80 uint8 PartsAlive = UINT8_MAX;
81
82 FTimerHandle InitializationTimerHandle;
83 bool bIsProperlyInitialized = false;
84};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCommandCenterEventSignature, class ACommandCenter *, CommandCenter)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FCommandCenterHealthEventSignature, class ACommandCenter *, CommandCenter, float, Delta)
Definition: CommandCenter.h:20
virtual bool GetIsObjectiveDead() const
Definition: CommandCenter.h:32
virtual int32 GetObjectiveSortOrder() const
Definition: CommandCenter.h:34
virtual int32 GetObjectiveTeam() const
Definition: CommandCenter.h:33
virtual bool GetIsObjectiveProperlyInitialized() const
Definition: CommandCenter.h:35
Definition: DeployableAutonomousTurret.h:14
Definition: DestroyableObjective.h:23
virtual void CheckForInitialization()
Definition: DestroyableObjective.cpp:448
virtual void BeginPlay() override
Definition: DestroyableObjective.cpp:43
virtual int32 GetTeam() const override
Definition: DestroyableObjective.cpp:347
Definition: TeamDeathmatchSpawnPoint.h:19
Definition: AllOutWarfareObjectiveInterface.h:19