LEAP Documentation 40220
Documentation for the LEAP project
ProjectXGameStateAllOutWarfare.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 "ProjectXGameStateAllOutWarfare.generated.h"
9
11class ACommandCenter;
13
15USTRUCT(BlueprintType)
17{
18 GENERATED_USTRUCT_BODY()
20
21 FTeamObjective(uint8 NewTeam)
22 {
23 Team = NewTeam;
24 Objective = nullptr;
25 }
26
27 UPROPERTY(BlueprintReadOnly)
28 AActor* Objective = nullptr;
29 UPROPERTY(BlueprintReadOnly)
30 uint8 Team = -1;
31};
32
33 /*A mapping for a team to its health for easy replication */
34USTRUCT(BlueprintType)
36{
37 GENERATED_USTRUCT_BODY()
38
39public:
40 UPROPERTY(BlueprintReadWrite, EditInstanceOnly, Category = "Score Info")
41 uint8 Team;
42 UPROPERTY(BlueprintReadWrite, EditInstanceOnly, Category = "Score Info")
43 float Percentage;
44};
45
46DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FTeamPercentagesSignature, const TArray<FTeamPercentage>&, TeamPercentages);
47DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FObjectivesChangedSignature, const TArray<FTeamObjective>&, Objectives);
48
53UCLASS()
55{
56 GENERATED_BODY()
57
58public:
59 void SaveObjectives(TArray<IAllOutWarfareObjectiveInterface*>& InObjectives);
60 virtual void HandleMatchWarmupEnded() override;
61 virtual int32 GetTeamWithHighestHealth();
62
63 UFUNCTION(BlueprintCallable)
64 bool GetShieldGeneratorsByTeam(uint8 Team, TArray<AShieldGenerator*>& FoundShieldGenerators) const;
65 UFUNCTION(BlueprintPure)
66 ACommandCenter* GetCommandCenterByTeam(uint8 Team) const;
67 UFUNCTION(BlueprintPure)
68 bool GetObjectivesForTeam(uint8 Team, TArray<AActor*>& FoundObjectives) const;
69 UFUNCTION(BlueprintPure)
70 TArray<FTeamObjective> GetObjectives() const;
71 UFUNCTION(BlueprintPure)
72 const TArray<FTeamPercentage>& GetTeamPercentages() const { return TeamPercentages; }
73
74 UPROPERTY(BlueprintAssignable)
75 FTeamPercentagesSignature OnTeamsPercentageChanged;
76 UPROPERTY(BlueprintAssignable)
77 FObjectivesChangedSignature OnObjectivesChanged;
78
79protected:
80 UFUNCTION()
81 virtual void OnRep_Objectives();
82 UFUNCTION()
83 virtual void OnRep_TeamPercentages();
84
85 UFUNCTION()
86 virtual void OnShieldIsUnderAttack(AShieldGenerator* ShieldUnderAttack);
87 UFUNCTION()
88 virtual void OnShieldHealthChanged(AShieldGenerator* ShieldUnderAttack, float Delta);
89 UFUNCTION()
90 virtual void OnCommandCenterUnderAttack(ACommandCenter* CommandCenterUnderAttack);
91 UFUNCTION()
92 virtual void OnCommandCenterHealthChanged(ACommandCenter* CommandCenterUnderAttack, float Delta);
93
94 virtual void OnObjectiveHealthChanged(IAllOutWarfareObjectiveInterface* Objective, float Delta);
95
96private:
97 UPROPERTY(ReplicatedUsing = OnRep_Objectives)
98 TArray<FTeamObjective> Objectives;
99 UPROPERTY(ReplicatedUsing = OnRep_TeamPercentages)
100 TArray<FTeamPercentage> TeamPercentages;
101
102 FString MatchStartAOW = "VO_MatchStart_AOW";
103
104 TMap<uint8, float> TeamMaxHealthConfig = TMap<uint8, float>();
105};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FTeamPercentagesSignature, const TArray< FTeamPercentage > &, TeamPercentages)
Definition: CommandCenter.h:20
Definition: ProjectXGameStateAllOutWarfare.h:55
Definition: ProjectXGameState.h:158
Definition: ShieldGenerator.h:30
Definition: AllOutWarfareObjectiveInterface.h:19
Definition: ProjectXGameStateAllOutWarfare.h:17
FTeamObjective(uint8 NewTeam)
Definition: ProjectXGameStateAllOutWarfare.h:21
Definition: ProjectXGameStateAllOutWarfare.h:36