레전드 복잡해서 자고 일어나서 해야겠다.

This commit is contained in:
2023-10-28 03:31:01 +09:00
parent 832a889afd
commit 9c071ad3fc
28 changed files with 306 additions and 122 deletions

View File

@@ -57,6 +57,7 @@ bAuthorizeAutomaticWidgetVariableCreation=False
+ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/Promether") +ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/Promether")
+ActiveGameNameRedirects=(OldGameName="/Script/TP_Blank",NewGameName="/Script/Promether") +ActiveGameNameRedirects=(OldGameName="/Script/TP_Blank",NewGameName="/Script/Promether")
+ActiveClassRedirects=(OldClassName="TP_BlankGameModeBase",NewClassName="PrometherGameModeBase") +ActiveClassRedirects=(OldClassName="TP_BlankGameModeBase",NewClassName="PrometherGameModeBase")
AssetManagerClassName=/Script/Promether.DefaultAssetManager
[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings] [/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings]
bEnablePlugin=True bEnablePlugin=True

View File

@@ -0,0 +1,13 @@
[/Script/GameplayTags.GameplayTagsSettings]
ImportTagsFromConfig=True
WarnOnInvalidTags=True
ClearInvalidTags=False
AllowEditorTagUnloading=True
AllowGameTagUnloading=False
FastReplication=False
InvalidTagCharacters="\"\',"
NumBitsForContainerSize=6
NetIndexFirstBitSegment=16
+GameplayTagList=(Tag="State.Dead",DevComment="")
+GameplayTagList=(Tag="State.EffectTag",DevComment="")

BIN
Content/Character/Lb/Abilities/BP_BaseAttack.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/NewControlRigBlueprint.uasset (Stored with Git LFS)

Binary file not shown.

View File

@@ -11,7 +11,8 @@
"AdditionalDependencies": [ "AdditionalDependencies": [
"Engine", "Engine",
"CoreUObject", "CoreUObject",
"AIModule" "AIModule",
"GameplayAbilities"
] ]
} }
], ],

View File

@@ -1,14 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AN_Skill4_End.h"
#include "../PlayerGeneric/DefaultPlayerCharacter.h"
void UAN_Skill4_End::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
{
ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner<ADefaultPlayerCharacter>();
if (!MyCharacter) return;
MyCharacter->Skill4_End();
}

View File

@@ -1,19 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotify.h"
#include "AN_Skill4_End.generated.h"
/**
*
*/
UCLASS()
class PROMETHER_API UAN_Skill4_End : public UAnimNotify
{
GENERATED_BODY()
public:
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
};

View File

@@ -1,5 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AN_Skill5.h"

View File

@@ -1,17 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotify.h"
#include "AN_Skill6.generated.h"
/**
*
*/
UCLASS()
class PROMETHER_API UAN_Skill6 : public UAnimNotify
{
GENERATED_BODY()
};

View File

@@ -1,5 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AN_Skill7.h"

View File

@@ -1,17 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotify.h"
#include "AN_Skill7.generated.h"
/**
*
*/
UCLASS()
class PROMETHER_API UAN_Skill7 : public UAnimNotify
{
GENERATED_BODY()
};

View File

@@ -0,0 +1,11 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "DefaultAssetManager.h"
#include "AbilitySystemGlobals.h"
void UDefaultAssetManager::StartInitialLoading()
{
Super::StartInitialLoading();
UAbilitySystemGlobals::Get().InitGlobalData();
}

View File

@@ -0,0 +1,19 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Engine/AssetManager.h"
#include "DefaultAssetManager.generated.h"
/**
*
*/
UCLASS()
class PROMETHER_API UDefaultAssetManager : public UAssetManager
{
GENERATED_BODY()
public:
virtual void StartInitialLoading() override;
};

View File

@@ -1,5 +1,5 @@
// Fill out your copyright notice in the Description page of Project Settings. // Fill out your copyright notice in the Description page of Project Settings.
#include "AN_Skill6.h" #include "CharacterGameplayAbility.h"

View File

@@ -3,14 +3,14 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotify.h" #include "Abilities/GameplayAbility.h"
#include "AN_Skill5.generated.h" #include "CharacterGameplayAbility.generated.h"
/** /**
* *
*/ */
UCLASS() UCLASS()
class PROMETHER_API UAN_Skill5 : public UAnimNotify class PROMETHER_API UCharacterGameplayAbility : public UGameplayAbility
{ {
GENERATED_BODY() GENERATED_BODY()

View File

@@ -0,0 +1,35 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CharacterBaseAttribute.h"
#include "Net/UnrealNetwork.h"
void UCharacterBaseAttribute::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME_CONDITION_NOTIFY(UCharacterBaseAttribute, Health, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UCharacterBaseAttribute, MaxHealth, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UCharacterBaseAttribute, Mana, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UCharacterBaseAttribute, MaxMana, COND_None, REPNOTIFY_Always);
}
void UCharacterBaseAttribute::OnRep_Health(const FGameplayAttributeData& OldHealth)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UCharacterBaseAttribute, Health, OldHealth);
}
void UCharacterBaseAttribute::OnRep_MaxHealth(const FGameplayAttributeData& OldMaxHealth)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UCharacterBaseAttribute, MaxHealth, OldMaxHealth);
}
void UCharacterBaseAttribute::OnRep_Mana(const FGameplayAttributeData& OldMana)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UCharacterBaseAttribute, Mana, OldMana);
}
void UCharacterBaseAttribute::OnRep_MaxMana(const FGameplayAttributeData& OldMaxMana)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UCharacterBaseAttribute, MaxMana, OldMaxMana);
}

View File

@@ -0,0 +1,56 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AttributeSet.h"
#include "AbilitySystemComponent.h"
#include "CharacterBaseAttribute.generated.h"
#define ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)
UCLASS()
class PROMETHER_API UCharacterBaseAttribute : public UAttributeSet
{
GENERATED_BODY()
public:
//Replicated
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
UPROPERTY(BlueprintReadonly, Category = "Health", ReplicatedUsing = OnRep_Health)
FGameplayAttributeData Health;
ATTRIBUTE_ACCESSORS(UCharacterBaseAttribute, Health)
UPROPERTY(BlueprintReadonly, Category = "Health", ReplicatedUsing = OnRep_MaxHealth)
FGameplayAttributeData MaxHealth;
ATTRIBUTE_ACCESSORS(UCharacterBaseAttribute, MaxHealth)
UPROPERTY(BlueprintReadonly, Category = "Mana", ReplicatedUsing = OnRep_Mana)
FGameplayAttributeData Mana;
ATTRIBUTE_ACCESSORS(UCharacterBaseAttribute, Mana)
UPROPERTY(BlueprintReadonly, Category = "Mana", ReplicatedUsing = OnRep_MaxMana)
FGameplayAttributeData MaxMana;
ATTRIBUTE_ACCESSORS(UCharacterBaseAttribute, MaxMana)
UFUNCTION()
virtual void OnRep_Health(const FGameplayAttributeData& OldHealth);
UFUNCTION()
virtual void OnRep_MaxHealth(const FGameplayAttributeData& OldMaxHealth);
UFUNCTION()
virtual void OnRep_Mana(const FGameplayAttributeData& OldMana);
UFUNCTION()
virtual void OnRep_MaxMana(const FGameplayAttributeData& OldMaxMana);
public:
//Not Replicated
UPROPERTY(BlueprintReadonly, Category = "Damage")
FGameplayAttributeData Damage;
ATTRIBUTE_ACCESSORS(UCharacterBaseAttribute, Damage)
};

View File

@@ -0,0 +1,9 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "DefaultAbilitySystemComponent.h"
void UDefaultAbilitySystemComponent::ReceiveDamage(UDefaultAbilitySystemComponent* SourceASC, float UnmitigatedDamage, float MitigatedDamage)
{
ReceivedDamage.ExecuteIfBound(SourceASC, UnmitigatedDamage, MitigatedDamage);
}

View File

@@ -0,0 +1,20 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemComponent.h"
#include "DefaultAbilitySystemComponent.generated.h"
DECLARE_DYNAMIC_DELEGATE_ThreeParams(FReceivedDamageDelegate, UDefaultAbilitySystemComponent*, SourceASC, float, UnmitigatedDamage, float, MitigatedDamage);
UCLASS()
class PROMETHER_API UDefaultAbilitySystemComponent : public UAbilitySystemComponent
{
GENERATED_BODY()
public:
FReceivedDamageDelegate ReceivedDamage;
virtual void ReceiveDamage(UDefaultAbilitySystemComponent* SourceASC, float UnmitigatedDamage, float MitigatedDamage);
};

View File

@@ -1,11 +1,24 @@
#include "DefaultPlayerState.h" #include "DefaultPlayerState.h"
#include "Net/UnrealNetwork.h" #include "Net/UnrealNetwork.h"
#include "../GAS/DefaultAbilitySystemComponent.h"
#include "../GAS/AttributeSet/CharacterBaseAttribute.h"
ADefaultPlayerState::ADefaultPlayerState() ADefaultPlayerState::ADefaultPlayerState()
{ {
CharacterBPRef = nullptr;; CharacterBPRef = nullptr;
Team = TeamType::Null; Team = TeamType::Null;
State = ECharacterState::Idle; State = ECharacterState::Idle;
AbilitySystemComponent = CreateDefaultSubobject<UDefaultAbilitySystemComponent>(TEXT("AbilitySystemComponent"));
AbilitySystemComponent->SetIsReplicated(true);
AbilitySystemComponent->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
Attribute = CreateDefaultSubobject<UCharacterBaseAttribute>(TEXT("Attribute"));
NetUpdateFrequency = 100.0f;
DeadTag = FGameplayTag::RequestGameplayTag(FName("State.Dead"));
EffectTag = FGameplayTag::RequestGameplayTag(FName("State.EffectTag"));
} }
void ADefaultPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const void ADefaultPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
@@ -28,6 +41,31 @@ void ADefaultPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>&
DOREPLIFETIME(ADefaultPlayerState, PreviousAttackTarget); DOREPLIFETIME(ADefaultPlayerState, PreviousAttackTarget);
} }
UAbilitySystemComponent* ADefaultPlayerState::GetAbilitySystemComponent() const
{
return AbilitySystemComponent;
}
float ADefaultPlayerState::GetHealth() const
{
return Attribute->GetHealth();
}
float ADefaultPlayerState::GetMaxHealth() const
{
return Attribute->GetMaxHealth();
}
float ADefaultPlayerState::GetMana() const
{
return Attribute->GetMana();
}
float ADefaultPlayerState::GetMaxMana() const
{
return Attribute->GetMaxMana();
}
void ADefaultPlayerState::InitPlayerStats_Implementation(const TArray<float>& StatsValue, const TArray<float>& CooldownDurationValue) void ADefaultPlayerState::InitPlayerStats_Implementation(const TArray<float>& StatsValue, const TArray<float>& CooldownDurationValue)
{ {
MaxStats.Append(StatsValue); MaxStats.Append(StatsValue);
@@ -88,6 +126,37 @@ void ADefaultPlayerState::SetPreviousAttackTarget(AActor* Target)
Client_SetPreviousAttackTarget(Target); Client_SetPreviousAttackTarget(Target);
} }
void ADefaultPlayerState::BeginPlay()
{
Super::BeginPlay();
if (AbilitySystemComponent)
{
HealthChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetHealthAttribute()).AddUObject(this, &ADefaultPlayerState::HealthChanged);
MaxHealthChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetMaxHealthAttribute()).AddUObject(this, &ADefaultPlayerState::MaxHealthChanged);
ManaChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetManaAttribute()).AddUObject(this, &ADefaultPlayerState::ManaChanged);
MaxManaChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetMaxManaAttribute()).AddUObject(this, &ADefaultPlayerState::MaxManaChanged);
//AbilitySystemComponent->RegisterGameplayTagEvent(FGameplayTag::Request)
}
}
void ADefaultPlayerState::HealthChanged(const FOnAttributeChangeData& Data)
{
}
void ADefaultPlayerState::MaxHealthChanged(const FOnAttributeChangeData& Data)
{
}
void ADefaultPlayerState::ManaChanged(const FOnAttributeChangeData& Data)
{
}
void ADefaultPlayerState::MaxManaChanged(const FOnAttributeChangeData& Data)
{
}
void ADefaultPlayerState::Server_SetPreviousAttackTarget_Implementation(AActor* Target) void ADefaultPlayerState::Server_SetPreviousAttackTarget_Implementation(AActor* Target)
{ {
PreviousAttackTarget = Target; PreviousAttackTarget = Target;

View File

@@ -4,16 +4,18 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "GameFramework/PlayerState.h" #include "GameFramework/PlayerState.h"
#include "AbilitySystemInterface.h"
#include "GameplayTagContainer.h"
#include "GameplayEffectTypes.h"
#include <iostream> #include <iostream>
#include <map> #include <map>
#include "../PrometherEnum.h" #include "../PrometherEnum.h"
#include "DefaultPlayerCharacter.h" #include "DefaultPlayerCharacter.h"
#include "../StatusEffect/StatusEffect.h"
#include "DefaultPlayerState.generated.h" #include "DefaultPlayerState.generated.h"
UCLASS() UCLASS()
class PROMETHER_API ADefaultPlayerState : public APlayerState class PROMETHER_API ADefaultPlayerState : public APlayerState, public IAbilitySystemInterface
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -21,14 +23,27 @@ public:
ADefaultPlayerState(); ADefaultPlayerState();
void GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const override; void GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const override;
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
UFUNCTION(Server, Reliable) UFUNCTION(Server, Reliable)
void InitPlayerStats(const TArray<float>& StatsValue, const TArray<float>& CooldownDurationValue); void InitPlayerStats(const TArray<float>& StatsValue, const TArray<float>& CooldownDurationValue);
void SetCharacterBPRef(UClass* Value) { CharacterBPRef = Value; } void SetCharacterBPRef(UClass* Value) { CharacterBPRef = Value; }
UClass* GetCharacterBPRef() const { return CharacterBPRef; } UClass* GetCharacterBPRef() const { return CharacterBPRef; }
UFUNCTION(BlueprintCallable, Category = "Attributes")
float GetHealth() const;
UFUNCTION(BlueprintCallable, Category = "Attributes")
float GetMaxHealth() const;
UFUNCTION(BlueprintCallable, Category = "Attributes")
float GetMana() const;
UFUNCTION(BlueprintCallable, Category = "Attributes")
float GetMaxMana() const;
class UCharacterBaseAttribute* GetAttributeSet() const;
//UFUNCTION(BlueprintCallable)
//bool IsDead() const;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetTeam(TeamType Value) { Team = Value; } void SetTeam(TeamType Value) { Team = Value; }
@@ -90,7 +105,28 @@ public:
UPROPERTY(Replicated, Transient, BlueprintReadWrite) UPROPERTY(Replicated, Transient, BlueprintReadWrite)
TArray<float> MaxCooldownDuration; TArray<float> MaxCooldownDuration;
protected:
class UDefaultAbilitySystemComponent* AbilitySystemComponent;
class UCharacterBaseAttribute* Attribute;
FGameplayTag DeadTag;
FGameplayTag EffectTag;
FDelegateHandle HealthChangedDelegateHandle;
FDelegateHandle MaxHealthChangedDelegateHandle;
FDelegateHandle ManaChangedDelegateHandle;
FDelegateHandle MaxManaChangedDelegateHandle;
virtual void BeginPlay() override;
virtual void HealthChanged(const FOnAttributeChangeData& Data);
virtual void MaxHealthChanged(const FOnAttributeChangeData& Data);
virtual void ManaChanged(const FOnAttributeChangeData& Data);
virtual void MaxManaChanged(const FOnAttributeChangeData& Data);
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Abilities")
TSubclassOf<class UGameplayEffect> DefaultAttributes;
private: private:
UPROPERTY(Replicated, Transient) UPROPERTY(Replicated, Transient)
UClass* CharacterBPRef; UClass* CharacterBPRef;

View File

@@ -4,3 +4,18 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
UENUM(BlueprintType)
enum class EDefaultAbilityID : uint8
{
None UMETA(DisplayName = "None"),
BaseAttack UMETA(DisplayName = "BaseAttack"),
Skill1 UMETA(DisplayName = "Skill1"),
Skill2 UMETA(DisplayName = "Skill2"),
Skill3 UMETA(DisplayName = "Skill3"),
Skill4 UMETA(DisplayName = "Skill4"),
RuneSpell1 UMETA(DisplayName = "RuneSpell1"),
RuneSpell2 UMETA(DisplayName = "RuneSpell2"),
Ward UMETA(DisplayName = "Ward"),
Bomb UMETA(DisplayName = "Bomb"),
SIZE
};

View File

@@ -1,5 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "StatusEffect.h"

View File

@@ -1,19 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "StatusEffect.generated.h"
/**
*
*/
UCLASS()
class PROMETHER_API UStatusEffect : public UObject
{
GENERATED_BODY()
public:
};