Initial Commit - Lesson 31 (Commit #1)
This commit is contained in:
37
Source/FPSTemplate/Public/Game/MatchGameState.h
Normal file
37
Source/FPSTemplate/Public/Game/MatchGameState.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameState.h"
|
||||
#include "MatchGameState.generated.h"
|
||||
|
||||
class AMatchPlayerState;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FPSTEMPLATE_API AMatchGameState : public AGameState
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
AMatchGameState();
|
||||
|
||||
AMatchPlayerState* GetLeader() const;
|
||||
|
||||
void UpdateLeader();
|
||||
bool HasFirstBloodBeenHad() const { return bHasFirstBloodBeenHad; }
|
||||
bool IsTiedForTheLead(AMatchPlayerState* PlayerState);
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
private:
|
||||
|
||||
UPROPERTY()
|
||||
TArray<TObjectPtr<AMatchPlayerState>> Leaders;
|
||||
|
||||
UPROPERTY()
|
||||
TArray<TObjectPtr<AMatchPlayerState>> SortedPlayerStates;
|
||||
|
||||
bool bHasFirstBloodBeenHad;
|
||||
};
|
||||
44
Source/FPSTemplate/Public/Game/ShooterGameMode.h
Normal file
44
Source/FPSTemplate/Public/Game/ShooterGameMode.h
Normal file
@@ -0,0 +1,44 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ShooterGameModeBase.h"
|
||||
|
||||
#if WITH_GAMELIFT
|
||||
#include "GameLiftServerSDK.h"
|
||||
#endif
|
||||
|
||||
#include "ShooterGameMode.generated.h"
|
||||
|
||||
|
||||
|
||||
struct FProcessParameters;
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogShooterGameMode, Log, All);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FPSTEMPLATE_API AShooterGameMode : public AShooterGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AShooterGameMode();
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
private:
|
||||
|
||||
void InitGameLift();
|
||||
#if WITH_GAMELIFT
|
||||
void SetServerParameters(TSharedPtr<FServerParameters> OutServerParameters);
|
||||
void LogServerParameters(TSharedPtr<FServerParameters> ServerParameters);
|
||||
#endif
|
||||
void ParseCommandLinePort(int32& OutPort);
|
||||
|
||||
TSharedPtr<FProcessParameters> ProcessParameters;
|
||||
};
|
||||
30
Source/FPSTemplate/Public/Game/ShooterGameModeBase.h
Normal file
30
Source/FPSTemplate/Public/Game/ShooterGameModeBase.h
Normal file
@@ -0,0 +1,30 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameMode.h"
|
||||
#include "ShooterGameModeBase.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FPSTEMPLATE_API AShooterGameModeBase : public AGameMode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
AShooterGameModeBase();
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
virtual void StartPlayerElimination(float ElimTime, ACharacter* ElimmedCharacter, class APlayerController* VictimController, APlayerController* AttackerController);
|
||||
|
||||
UPROPERTY()
|
||||
TMap<APlayerController*, FTimerHandle> Timers;
|
||||
|
||||
virtual void PlayerEliminated(ACharacter* ElimmedCharacter, class APlayerController* VictimController, APlayerController* AttackerController);
|
||||
virtual void RequestRespawn(ACharacter* ElimmedCharacter, AController* ElimmedController);
|
||||
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category="Respawning")
|
||||
float RespawnTime;
|
||||
};
|
||||
Reference in New Issue
Block a user