Spawn and delete fireballs using new keybinds

+ Follow UE4 example for spawning and destroying actors
+ https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/SpawnAndDestroyActors/
+ This version uses hybrid C++ and Blueprints instead of doing one or the other
+ Functions to spawn and delete fireballs exposed by UFUNCTION() prefix
This commit is contained in:
2022-01-12 17:33:37 -05:00
parent e1737bd37f
commit f1695a165e
19 changed files with 276 additions and 9 deletions

View File

@@ -0,0 +1,31 @@
// All content (c) Shaun Reed 2021, all rights reserved
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "ActorSpawner.generated.h"
UCLASS(Blueprintable)
class THIRDPERSON_API AActorSpawner : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AActorSpawner();
UFUNCTION(BlueprintCallable, Category = "Spawn")
void SpawnActor();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class UBoxComponent* SpawnVolume;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};

View File

@@ -0,0 +1,37 @@
// All content (c) Shaun Reed 2021, all rights reserved
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "BallActor.generated.h"
UCLASS()
class THIRDPERSON_API ABallActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ABallActor();
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float sizeScale = 1.0;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class USphereComponent* SphereComp;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* StaticMeshComp;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class UParticleSystemComponent* ParticleComp;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};