24. Health and Mana
Decided to try using gencpp for the first time with UE (just codegen, not parsing). I used it to generate the AttributeSet
This commit is contained in:
		| @@ -1,2 +1,39 @@ | ||||
| #include "GasaAttributeSet.h" | ||||
| // This was generated by GasaGen/GasaGen.cpp | ||||
| #include "GasaAttributeSet.h" | ||||
|  | ||||
| #include "AbilitySystemComponent.h" | ||||
| #include "Net/UnrealNetwork.h" | ||||
| #include "Networking/GasaNetLibrary.h" | ||||
|  | ||||
| UGasaAttributeSet::UGasaAttributeSet() | ||||
| { | ||||
| } | ||||
|  | ||||
| void UGasaAttributeSet::Client_OnRep_Health( FGameplayAttributeData& PrevHealth ) | ||||
| { | ||||
| 	GAMEPLAYATTRIBUTE_REPNOTIFY( UGasaAttributeSet, Health, PrevHealth ) | ||||
| } | ||||
|  | ||||
| void UGasaAttributeSet::Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth ) | ||||
| { | ||||
| 	GAMEPLAYATTRIBUTE_REPNOTIFY( UGasaAttributeSet, MaxHealth, PrevMaxHealth ) | ||||
| } | ||||
|  | ||||
| void UGasaAttributeSet::Client_OnRep_Mana( FGameplayAttributeData& PrevMana ) | ||||
| { | ||||
| 	GAMEPLAYATTRIBUTE_REPNOTIFY( UGasaAttributeSet, Mana, PrevMana ) | ||||
| } | ||||
|  | ||||
| void UGasaAttributeSet::Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana ) | ||||
| { | ||||
| 	GAMEPLAYATTRIBUTE_REPNOTIFY( UGasaAttributeSet, MaxMana, PrevMaxMana ) | ||||
| } | ||||
|  | ||||
| void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray< FLifetimeProperty >& OutLifetimeProps ) const | ||||
| { | ||||
| 	Super::GetLifetimeReplicatedProps( OutLifetimeProps ); | ||||
| 	DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Health ); | ||||
| 	DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxHealth ); | ||||
| 	DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Mana ); | ||||
| 	DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxMana ); | ||||
| } | ||||
|   | ||||
| @@ -1,15 +1,38 @@ | ||||
| #pragma once | ||||
| #include "AttributeSet.h" | ||||
| // This was generated by GasaGen/GasaGen.cpp | ||||
|  | ||||
| #include "AttributeSet.h" | ||||
|  | ||||
| #include "GasaAttributeSet.generated.h" | ||||
|  | ||||
|  | ||||
| UCLASS() | ||||
| class GASA_API UGasaAttributeSet : public UAttributeSet | ||||
| UCLASS() class GASA_API UGasaAttributeSet : public UAttributeSet | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	 | ||||
| }; | ||||
| 	UPROPERTY( ReplicatedUsing = Client_OnRep_Health, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) | ||||
| 	FGameplayAttributeData Health; | ||||
|  | ||||
| 	UPROPERTY( ReplicatedUsing = Client_OnRep_Health, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) | ||||
| 	FGameplayAttributeData MaxHealth; | ||||
|  | ||||
| 	UPROPERTY( ReplicatedUsing = Client_OnRep_Health, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) | ||||
| 	FGameplayAttributeData Mana; | ||||
|  | ||||
| 	UPROPERTY( ReplicatedUsing = Client_OnRep_Health, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) | ||||
| 	FGameplayAttributeData MaxMana; | ||||
|  | ||||
| 	UGasaAttributeSet(); | ||||
|  | ||||
| 	UFUNCTION() | ||||
| 	void Client_OnRep_Health( FGameplayAttributeData& PrevHealth ); | ||||
| 	UFUNCTION() | ||||
| 	void Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth ); | ||||
| 	UFUNCTION() | ||||
| 	void Client_OnRep_Mana( FGameplayAttributeData& PrevMana ); | ||||
| 	UFUNCTION() | ||||
| 	void Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana ); | ||||
|  | ||||
| #pragma region UObject | ||||
|  | ||||
| 	void GetLifetimeReplicatedProps( TArray< FLifetimeProperty >& OutLifetimeProps ) const override; | ||||
| #pragma endregion UObject | ||||
| }; | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| #pragma once | ||||
|  | ||||
|  | ||||
| namespace Gasa | ||||
| { | ||||
| 	constexpr float NetCullDist_Default   = 225000000.0f; | ||||
| @@ -11,5 +10,8 @@ namespace Gasa | ||||
| 	constexpr float NetCullDist_Distant   = 7000.0f  * 7000.0f; | ||||
| 	constexpr float NetCullDist_Far       = 8500.0f  * 8500.0f; | ||||
| 	constexpr float NetCullDist_VeryFar   = 10000.0f * 10000.0f; | ||||
| 	constexpr float NetCullDist_VisualMax = 15000.0f * 15000.0f;	 | ||||
| 	constexpr float NetCullDist_VisualMax = 15000.0f * 15000.0f; | ||||
|  | ||||
| 	#define DOREPLIFETIME_DEFAULT_GAS(Class, ReplicatedVar) \ | ||||
| 		DOREPLIFETIME_CONDITION_NOTIFY(Class, ReplicatedVar, COND_None, REPNOTIFY_Always) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user