Migration
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// Amasson
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/Interface.h"
|
||||
#include "GameplayEffectInterceptor.generated.h"
|
||||
|
||||
// This class does not need to be modified.
|
||||
UINTERFACE(MinimalAPI)
|
||||
class UGameplayEffectInterceptor : public UInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class AURA_API IGameplayEffectInterceptor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
|
||||
public:
|
||||
|
||||
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Effect Interceptor")
|
||||
void WillApplyGameplayEffectSpec(const FGameplayEffectSpec& GameplayEffect, bool& bIntercepted);
|
||||
|
||||
};
|
||||
@@ -0,0 +1,77 @@
|
||||
// Amasson
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "LevelingExperienceComponent.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLevelChangedSignature, int32, NewLevel);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnExperienceChangedSignature, int32, TotalExperience, float, Progress);
|
||||
|
||||
|
||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||
class AURA_API ULevelingExperienceComponent : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
protected:
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
|
||||
ULevelingExperienceComponent();
|
||||
|
||||
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
||||
|
||||
/* Level */
|
||||
FORCEINLINE int32 GetPlayerLevel() const { return Level; }
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Level")
|
||||
void AddToLevel(int32 AddLevel, bool KeepProgressPercent = true);
|
||||
UFUNCTION(BlueprintCallable, Category = "Level")
|
||||
void SetLevel(int32 NewLevel, bool KeepProgressPercent = true);
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Level")
|
||||
FOnLevelChangedSignature OnLevelChanged;
|
||||
|
||||
/* Experience */
|
||||
FORCEINLINE int32 GetExperience() const { return Experience; }
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Experience")
|
||||
void AddToExperience(int32 AddExperience);
|
||||
UFUNCTION(BlueprintCallable, Category = "Experience")
|
||||
void SetExperience(int32 NewExperience);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Experience")
|
||||
float GetExperienceProgress() const;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Experience")
|
||||
FOnExperienceChangedSignature OnExperienceChanged;
|
||||
|
||||
/* Leveling Infos */
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Data")
|
||||
TObjectPtr<class ULevelingInfo> LevelingInfo;
|
||||
|
||||
private:
|
||||
|
||||
void UpdateLevel(bool ForwardOnly);
|
||||
|
||||
/* Level */
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, ReplicatedUsing = OnRep_Level, Category = "Level", meta = (AllowPrivateAccess = true))
|
||||
int32 Level = 1;
|
||||
UFUNCTION() void OnRep_Level(int32 OldLevel) const;
|
||||
|
||||
/* Experience */
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, ReplicatedUsing = OnRep_Experience, Category = "Experience", meta = (AllowPrivateAccess = true))
|
||||
int32 Experience = 0;
|
||||
UFUNCTION() void OnRep_Experience(int32 OldExperience) const;
|
||||
|
||||
/* Cached Experiences */
|
||||
int32 CachedLevel = -1;
|
||||
int32 CachedMinExperience;
|
||||
int32 CachedMaxExperience;
|
||||
|
||||
void UpdateCacheLevel();
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
// Amasson
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "PerkPointsComponent.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPointChangedSignature, int32, NewPoints);
|
||||
|
||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||
class AURA_API UPerkPointsComponent : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this component's properties
|
||||
UPerkPointsComponent();
|
||||
|
||||
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
||||
|
||||
/** Attribute Points */
|
||||
|
||||
FORCEINLINE int32 GetAttributePoints() const { return AttributePoints; }
|
||||
UFUNCTION(BlueprintCallable, Category = "Attributes")
|
||||
void AddToAttributePoints(int32 AddingPoints);
|
||||
UFUNCTION(BlueprintCallable, Category = "Attributes")
|
||||
int32 SpendAttributePoints(int32 Count);
|
||||
UFUNCTION(BlueprintCallable, Category = "Attributes")
|
||||
void SetAttributePoints(int32 NewPoints);
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Attributes")
|
||||
FOnPointChangedSignature OnAttributePointsChangedDelegate;
|
||||
|
||||
/** Ability Points */
|
||||
|
||||
FORCEINLINE int32 GetAbilityPoints() const { return AbilityPoints; }
|
||||
UFUNCTION(BlueprintCallable, Category = "Abilities")
|
||||
void AddToAbilityPoints(int32 AddingPoints);
|
||||
UFUNCTION(BlueprintCallable, Category = "Abilities")
|
||||
int32 SpendAbilityPoints(int32 Count);
|
||||
UFUNCTION(BlueprintCallable, Category = "Abilities")
|
||||
void SetAbilityPoints(int32 NewPoints);
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Abilities")
|
||||
FOnPointChangedSignature OnAbilityPointsChangedDelegate;
|
||||
|
||||
protected:
|
||||
|
||||
/** Attribute Points */
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_AttributePoints, Category = "Attributes")
|
||||
int32 AttributePoints = 0;
|
||||
UFUNCTION() void OnRep_AttributePoints(int32 OldAttributePoints) const;
|
||||
|
||||
/** Ability Points */
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_AbilityPoints, Category = "Abilitys")
|
||||
int32 AbilityPoints = 0;
|
||||
UFUNCTION() void OnRep_AbilityPoints(int32 OldAbilityPoints) const;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user