WIP: Boostrapping NetSlime
- Just a old name for a set of changes to make the game framework hardened for multiplayer as well as some ease of use functionality.
This commit is contained in:
@ -8,34 +8,31 @@
|
||||
|
||||
UGasaAttributeSet::UGasaAttributeSet()
|
||||
{
|
||||
InitHealth( 50.f );
|
||||
InitHealth( 100.f );
|
||||
InitMaxHealth( 100.f );
|
||||
InitMana( 50.f );
|
||||
InitMaxMana( 50.f );
|
||||
}
|
||||
#pragma region Rep Notifies
|
||||
|
||||
#pragma region Rep Notifies
|
||||
void UGasaAttributeSet::Client_OnRep_Health( FGameplayAttributeData& PrevHealth )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Health, PrevHealth );
|
||||
}
|
||||
|
||||
void UGasaAttributeSet::Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxHealth, PrevMaxHealth );
|
||||
}
|
||||
|
||||
void UGasaAttributeSet::Client_OnRep_Mana( FGameplayAttributeData& PrevMana )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Mana, PrevMana );
|
||||
}
|
||||
|
||||
void UGasaAttributeSet::Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
@ -43,6 +40,7 @@ void UGasaAttributeSet::Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMan
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxMana, PrevMaxMana );
|
||||
}
|
||||
#pragma endregion Rep Notifies
|
||||
|
||||
void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray<FLifetimeProperty>& OutLifetimeProps ) const
|
||||
{
|
||||
Super::GetLifetimeReplicatedProps( OutLifetimeProps );
|
||||
|
@ -23,6 +23,7 @@ public:
|
||||
|
||||
UGasaAttributeSet();
|
||||
|
||||
|
||||
UFUNCTION()
|
||||
void Client_OnRep_Health( FGameplayAttributeData& PrevHealth );
|
||||
UFUNCTION()
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "GasaAttributeSet.h"
|
||||
#include "AbilitySystemComponent.h"
|
||||
|
||||
#pragma region Attribute Setters
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetHealth( float NewVal )
|
||||
{
|
||||
@ -40,6 +41,7 @@ void UGasaAttributeSet::SetMaxMana( float NewVal )
|
||||
AbilityComp->SetNumericAttributeBase( GetMaxManaAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
#pragma endregion Attribute Setters
|
||||
|
||||
namespace Gasa
|
||||
{
|
||||
|
@ -10,13 +10,13 @@ AGasaEffectActor::AGasaEffectActor()
|
||||
RootComponent = CreateDefaultSubobject<USceneComponent>("Root");
|
||||
}
|
||||
|
||||
void AGasaEffectActor::ApplyEffectToTarget(AActor* Target, TSubclassOf<UGameplayEffect> EffectClass)
|
||||
void AGasaEffectActor::ApplyEffectToActor(AActor* Actor, TSubclassOf<UGameplayEffect> EffectClass)
|
||||
{
|
||||
UGasaAbilitySystemComp* AS = GetAbilitySystem(Target, true);
|
||||
UGasaAbilitySystemComp* AS = GetAbilitySystem(Actor, true);
|
||||
|
||||
FGameplayEffectContextHandle
|
||||
Context = AS->MakeEffectContext();
|
||||
Context.AddSourceObject(Target);
|
||||
Context.AddSourceObject(Actor);
|
||||
|
||||
FGameplayEffectSpecHandle Spec = AS->MakeOutgoingSpec( EffectClass, 1.0f, Context );
|
||||
AS->ApplyGameplayEffectSpecToSelf( * Spec.Data );
|
||||
|
@ -1,19 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "GasaCommon.h"
|
||||
#include "Actors/GasaActor.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
|
||||
#include "GasaEffectActor.generated.h"
|
||||
|
||||
|
||||
UCLASS()
|
||||
class GASA_API AGasaEffectActor : public AActor
|
||||
class GASA_API AGasaEffectActor : public AGasaActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Applied Effects")
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gameplay Effects")
|
||||
TSoftClassPtr<UGameplayEffect> InstantEffectClass;
|
||||
|
||||
AGasaEffectActor();
|
||||
|
||||
void ApplyEffectToTarget(AActor* Target, TSubclassOf<UGameplayEffect> EffectClass );
|
||||
UFUNCTION(BlueprintCallable, Category = "Gameplay Effects")
|
||||
void ApplyEffectToActor(AActor* Actor, TSubclassOf<UGameplayEffect> EffectClass );
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "GasaAttributeSet.h"
|
||||
#include "GasaAttributeSet_Inlines.h"
|
||||
#include "Components/SphereComponent.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
|
||||
|
||||
AGasaEffectActorDemo::AGasaEffectActorDemo()
|
||||
|
@ -1,12 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "GasaCommon.h"
|
||||
#include "Actors/GasaActor.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
|
||||
#include "GasaEffectActorDemo.generated.h"
|
||||
|
||||
// Old demonstration code used before part 37.
|
||||
UCLASS()
|
||||
class GASA_API AGasaEffectActorDemo : public AActor
|
||||
class GASA_API AGasaEffectActorDemo : public AGasaActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
Reference in New Issue
Block a user