61 lines
1.2 KiB
C++
Executable File
61 lines
1.2 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 "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;
|
|
|
|
private:
|
|
|
|
/**
|
|
* 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;
|
|
};
|