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:
31
Source/ThirdPerson/Public/ActorSpawner.h
Normal file
31
Source/ThirdPerson/Public/ActorSpawner.h
Normal 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;
|
||||
|
||||
};
|
||||
37
Source/ThirdPerson/Public/BallActor.h
Normal file
37
Source/ThirdPerson/Public/BallActor.h
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user