presidents-brigade/Source/PresidentsBrigade/EnemySpawner.h
2022-11-19 12:50:05 -08:00

79 lines
1.6 KiB
C++
Executable File

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "BasePawn.h"
#include "AIController.h"
#include "LevelLocation.h"
#include "EnemySpawner.generated.h"
UCLASS()
class PRESIDENTSBRIGADE_API AEnemySpawner : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AEnemySpawner();
// Called every frame
virtual void Tick(float DeltaTime) override;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
/**
* Delay between spawning each enemy in seconds.
*/
UPROPERTY(EditAnywhere, Category = "Enemy")
float spawn_delay_s;
/**
* Enemy pawn class.
*/
UPROPERTY(EditAnywhere, Category = "Enemy")
TSubclassOf<ABasePawn> pawn_class;
/**
* Enemy controller class.
*/
UPROPERTY(EditAnywhere, Category = "Enemy")
TSubclassOf<AAIController> controller_class;
/**
* Enemy spawn location marker.
*/
UPROPERTY(EditAnywhere, Category = "Enemy")
UClass* marker_class;
/**
* Max number of enemies to spawn in one cycle.
*/
UPROPERTY(EditAnywhere, Category = "Enemy")
int max_spawn_count;
private:
/**
* Level location.
*/
TUniquePtr<LevelLocation> level_location;
/**
* Random number stream.
*/
FRandomStream random;
/**
* Threshold in seconds to wait before spawning.
*/
float next_spawn_threshold_s;
/**
* Current wait time in seconds.
*/
float spawn_wait_s;
};