|
@@ -3,11 +3,11 @@
|
|
|
#pragma once
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
-#include "Runtime/Engine/Classes/Components/ActorComponent.h"
|
|
|
+#include "EzAbilityContext.h"
|
|
|
+#include "EzAbilityInstance.h"
|
|
|
+#include "Components/ActorComponent.h"
|
|
|
#include "EzAbilityComponent.generated.h"
|
|
|
|
|
|
-class UEzAbilityContext;
|
|
|
-
|
|
|
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
|
|
|
class EZABILITY_API UEzAbilityComponent : public UActorComponent
|
|
|
{
|
|
@@ -22,13 +22,49 @@ protected:
|
|
|
virtual void BeginPlay() override;
|
|
|
|
|
|
public:
|
|
|
- // Called every frame
|
|
|
+ virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
|
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
|
|
|
|
|
+
|
|
|
+ UFUNCTION(BlueprintCallable)
|
|
|
+ bool ActivateAbility(UEzAbility* Ability, AActor* Instigator = nullptr);
|
|
|
+
|
|
|
UFUNCTION(BlueprintCallable)
|
|
|
- void ActiveAbility();
|
|
|
+ bool CancelAbility();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FAbilityRunStatusChanged, EAbilityRunStatus, RunStatus);
|
|
|
+ /** Called when the run status of the Ability has changed */
|
|
|
+ UPROPERTY(BlueprintAssignable, Category = "Ability")
|
|
|
+ FAbilityRunStatusChanged OnAbilityRunStatusChanged;
|
|
|
|
|
|
protected:
|
|
|
- UPROPERTY(Transient)
|
|
|
- TObjectPtr<UEzAbilityContext> AbilityContext;
|
|
|
+ UFUNCTION()
|
|
|
+ void OnRep_AbilityInstances();
|
|
|
+
|
|
|
+ UFUNCTION(Server, reliable, WithValidation)
|
|
|
+ void ServerActivateAbility();
|
|
|
+
|
|
|
+ UFUNCTION(Client, reliable)
|
|
|
+ void ClientActivateAbility();
|
|
|
+
|
|
|
+ UFUNCTION(Server, reliable, WithValidation)
|
|
|
+ void ServerEndAbility();
|
|
|
+
|
|
|
+ UFUNCTION(Client, reliable)
|
|
|
+ void ClientEndAbility();
|
|
|
+
|
|
|
+ UFUNCTION(Server, reliable, WithValidation)
|
|
|
+ void ServerCancelAbility();
|
|
|
+
|
|
|
+ UFUNCTION(Client, reliable)
|
|
|
+ void ClientCancelAbility();
|
|
|
+
|
|
|
+protected:
|
|
|
+ UPROPERTY(BlueprintReadOnly, Transient, Category="Ability")
|
|
|
+ FEzAbilityContext AbilityContext;
|
|
|
+
|
|
|
+ UPROPERTY(BlueprintReadOnly, Transient, Category="Ability", ReplicatedUsing=OnRep_AbilityInstances)
|
|
|
+ FEzAbilityInstanceContainer AbilityInstances;
|
|
|
};
|