Protptype of a wave based, first person shooter game made in Unreal Engine 4
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
MechDefence/Public/MGameMode.h

96 lines
2.7 KiB

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "GameplayTagAssetInterface.h"
#include "MGameMode.generated.h"
UENUM(BlueprintType)
enum class EWaveState : uint8
{
WaitingToStart,
WaveInProgress,
WaitingToComplete, // All the enemies have been spawned and we're waiting for them to be destroyed or for the player to die to move to next state
WaveComplete,
GameOver,
LevelComplete
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnActorKilledSignature, AActor*, VictimActor, AActor*, KillerActor, AController*, KillerController);
UCLASS()
class MECHDEFENCE_API AMGameMode : public AGameModeBase
{
GENERATED_BODY()
protected:
UPROPERTY(EditDefaultsOnly, Category = "GameMode")
TSubclassOf<AActor> SpectatingViewPointClass;
UPROPERTY(EditDefaultsOnly, Category = "GameMode")
float LevelEndViewTargetBlendTime;
UPROPERTY(EditDefaultsOnly, Category = "GameMode")
float TimeBetweenWaves;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "GameMode")
int WaveCount;
UPROPERTY(EditDefaultsOnly, Category = "GameMode")
int MaxEnemiesInWave;
UPROPERTY(EditDefaultsOnly, Category = "GameMode")
int MinEnemiesInWave;
UPROPERTY(EditDefaultsOnly, meta = (Tooltip = "These are the tags that are used to check how many enemies spawned in the current wave remain in the level"), Category = "GameMode")
FGameplayTagContainer SpawnedEnemyTags;
virtual void StartPlay() override;
UFUNCTION(BlueprintCallable)
void HandlePlayerKilled();
UFUNCTION(BlueprintCallable)
void HandlePlayerVehicleDestroyed(AActor* Vehicle);
UFUNCTION(BlueprintCallable)
void GameOver();
UFUNCTION(BlueprintCallable)
void LevelCompleted();
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, Category = "GameMode")
void SpawnNewEnemy();
UFUNCTION(BlueprintImplementableEvent, Category = "GameMode")
void WaveStateChanged(EWaveState NewState, EWaveState OldState);
UFUNCTION(BlueprintCallable, Category = "GameMode")
void StartWave();
void PrepareForNextWave();
void EndWave();
void CheckWaveState();
void SetWaveState(EWaveState NewWaveState);
void SpawnEnemyTimerElapsed();
int NumEnemiesToSpawn;
FTimerHandle TimerHandle_NextWaveStart;
FTimerHandle TimerHandle_EnemySpawn;
EWaveState WaveState;
public:
UPROPERTY(BlueprintAssignable, Category = "GameMode")
FOnActorKilledSignature OnActorKilled;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "GameMode")
int NumEnemiesKilled;
void Tick(float DeltaSeconds) override;
AMGameMode();
};