Add Basic Spell System (#9)

Co-authored-by: alhashij <alhashimy.janna@gmail.com>
Reviewed-on: #9
Co-authored-by: Lance1416 <lanceli1416@gmail.com>
Co-committed-by: Lance1416 <lanceli1416@gmail.com>
This commit was merged in pull request #9.
This commit is contained in:
2025-05-22 01:44:20 -04:00
committed by Lance Li
parent c040d71325
commit f3b2cf8c32
24 changed files with 196 additions and 76 deletions
@@ -0,0 +1,27 @@
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "SpellInteractable.generated.h"
UINTERFACE(MinimalAPI, Blueprintable)
class USpellInteractable : public UInterface
{
GENERATED_BODY()
};
/**
* Interface for objects that can be interacted with by spells.
*/
class WIZARDINGCENTRAL_API ISpellInteractable
{
GENERATED_BODY()
public:
/**
* Called when the spell is cast on the object.
* @param SpellName The name of the spell that was cast.
*/
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Spell")
void OnSpellCast(const FString& SpellName);
};
@@ -0,0 +1,24 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "SpellInteractableActor.h"
// Sets default values
ASpellInteractableActor::ASpellInteractableActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void ASpellInteractableActor::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ASpellInteractableActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
@@ -0,0 +1,27 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "SpellInteractable.h"
#include "GameFramework/Actor.h"
#include "SpellInteractableActor.generated.h"
UCLASS()
class WIZARDINGCENTRAL_API ASpellInteractableActor : public AActor,
public ISpellInteractable
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ASpellInteractableActor();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};