214 - Teams
This commit is contained in:
parent
3da023c406
commit
a1892bc4b7
|
@ -11,6 +11,8 @@ void ABlasterGameState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& Ou
|
||||||
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
||||||
|
|
||||||
DOREPLIFETIME(ABlasterGameState, TopScoringPlayers);
|
DOREPLIFETIME(ABlasterGameState, TopScoringPlayers);
|
||||||
|
DOREPLIFETIME(ABlasterGameState, RedTeamScore);
|
||||||
|
DOREPLIFETIME(ABlasterGameState, BlueTeamScore);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABlasterGameState::UpdateTopScore(ABlasterPlayerState* ScoringPlayer)
|
void ABlasterGameState::UpdateTopScore(ABlasterPlayerState* ScoringPlayer)
|
||||||
|
@ -31,3 +33,13 @@ void ABlasterGameState::UpdateTopScore(ABlasterPlayerState* ScoringPlayer)
|
||||||
TopScore = ScoringPlayer->GetScore();
|
TopScore = ScoringPlayer->GetScore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ABlasterGameState::OnRep_RedTeamScore()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ABlasterGameState::OnRep_BlueTeamScore()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -19,7 +19,23 @@ public:
|
||||||
void UpdateTopScore(class ABlasterPlayerState* ScoringPlayer);
|
void UpdateTopScore(class ABlasterPlayerState* ScoringPlayer);
|
||||||
|
|
||||||
UPROPERTY(Replicated)
|
UPROPERTY(Replicated)
|
||||||
TArray<class ABlasterPlayerState*> TopScoringPlayers;
|
TArray<ABlasterPlayerState*> TopScoringPlayers;
|
||||||
|
|
||||||
|
// Teams
|
||||||
|
TArray<ABlasterPlayerState*> RedTeam;
|
||||||
|
TArray<ABlasterPlayerState*> BlueTeam;
|
||||||
|
|
||||||
|
UPROPERTY(ReplicatedUsing = OnRep_RedTeamScore)
|
||||||
|
float RedTeamScore = 0.f;
|
||||||
|
|
||||||
|
UPROPERTY(ReplicatedUsing = OnRep_BlueTeamScore)
|
||||||
|
float BlueTeamScore = 0.f;
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void OnRep_RedTeamScore();
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void OnRep_BlueTeamScore();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ void ABlasterPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>&
|
||||||
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
||||||
|
|
||||||
DOREPLIFETIME(ABlasterPlayerState, Defeats);
|
DOREPLIFETIME(ABlasterPlayerState, Defeats);
|
||||||
|
DOREPLIFETIME(ABlasterPlayerState, Team);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABlasterPlayerState::IncreaseScore(float ScoreAmount)
|
void ABlasterPlayerState::IncreaseScore(float ScoreAmount)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "Blaster/Types/Team.h"
|
||||||
#include "GameFramework/PlayerState.h"
|
#include "GameFramework/PlayerState.h"
|
||||||
#include "BlasterPlayerState.generated.h"
|
#include "BlasterPlayerState.generated.h"
|
||||||
|
|
||||||
|
@ -31,4 +32,12 @@ private:
|
||||||
|
|
||||||
UPROPERTY(ReplicatedUsing = OnRep_Defeats)
|
UPROPERTY(ReplicatedUsing = OnRep_Defeats)
|
||||||
int32 Defeats;
|
int32 Defeats;
|
||||||
|
|
||||||
|
UPROPERTY(Replicated)
|
||||||
|
ETeam Team = ETeam::ET_NoTeam;
|
||||||
|
|
||||||
|
public:
|
||||||
|
FORCEINLINE ETeam GetTeam() const { return Team; }
|
||||||
|
FORCEINLINE void SetTeam(ETeam TeamToSet) { Team = TeamToSet; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
UENUM(BlueprintType)
|
||||||
|
enum class ETeam : uint8
|
||||||
|
{
|
||||||
|
ET_RedTeam UMETA(DiaplayName = "RedTeam"),
|
||||||
|
ET_BlueTeam UMETA(DiaplayName = "BlueTeam"),
|
||||||
|
ET_NoTeam UMETA(DiaplayName = "No Team"),
|
||||||
|
|
||||||
|
ET_Max UMETA(DisplayName = "DefaultMax")
|
||||||
|
};
|
Loading…
Reference in New Issue