I’m trying to create custom actor components which have implementable events. I have a basic unit class and a basic spell class, and I want to be able to create custom blueprints from those to make different types of units and different spells.
I have a few events I want to be able to implement such as “OnCastBegin”, “OnCastSuccess”, and “OnCastFailure” etc. Here’s the full code for my ability’s header class:
#pragma once
#include "KBuff.h"
#include "KAbility.generated.h"
/**
*
*/
/*
TODO:
- Active Component: the action which happens if the ability is activated. An ability may or may not have an active.
- Passive Component: the passive effects of the ability. An ability may or may not have passive effects.
*/
class AKBasePawn;
UCLASS(ClassGroup=(Ability), meta=(BlueprintSpawnableComponent))
class KIDSOFTHEWOODS_API UKAbility : public UActorComponent
{
GENERATED_BODY()
public:
UKAbility();
~UKAbility();
UFUNCTION(BlueprintImplementableEvent, Category = "KAbility")
void OnCastBegin();
UFUNCTION(BlueprintImplementableEvent, Category = "KAbility")
void OnCastFail();
UFUNCTION(BlueprintImplementableEvent, Category = "KAbility")
void OnCastSuccess();
UFUNCTION(BlueprintImplementableEvent, Category = "KAbility")
void OnTargetHit(const AKBasePawn *Target);
UFUNCTION(BluePrintCallable, Category = "KAbility")
void ActivateAbility();
protected:
AKBasePawn *owningUnit;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "KAbility")
float castTime;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "KAbility")
UKBuff *passiveAbility;
};
When I look at the static mesh reference of my blueprint, it has a ton of implementable events such as OnMouseOver, OnClicked, etc. I can’t figure out how to do that for my component.