UE4 C++的函数和事件的定义
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "SpwanVolume.generated.h"
UCLASS()
class GETSTARTED_API ASpwanVolume : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ASpwanVolume();
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
class UBoxComponent* SpawnBox;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Spawn Volume")
TArray<TSubclassOf<AActor>> SpawnActorClassesArray;//TSubclassOf 一个模板类
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UFUNCTION(BlueprintCallable, Category = "Spawn Volume")
FVector GetSpawnPoint();
UFUNCTION(BlueprintCallable, Category = "Spawn Volume")
TSubclassOf<AActor> GetSpwnActorClass();
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Spawn Volume")
void SpawnActor();
};