initial stuff hopefully this works

This commit is contained in:
Ji Yoon Rhee
2023-10-09 19:37:22 -04:00
parent c1910ab988
commit 01555c3ccf
490 changed files with 405854 additions and 0 deletions

View File

@ -0,0 +1,15 @@
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
public class hwanyoung2Target : TargetRules
{
public hwanyoung2Target(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V2;
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
ExtraModuleNames.Add("hwanyoung2");
}
}

View File

@ -0,0 +1,10 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "HYAIController.h"
AHYAIController::AHYAIController()
{
//if we create a new AI instance, it will want to have its own player state:
bWantsPlayerState = true;
}

View File

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

View File

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

View File

@ -0,0 +1,30 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemComponent.h"
#include "HYCharacAbilitySystemComponent.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FReceivedDamageDelegate,
UHYCharacAbilitySystemComponent*, SourceASC, float, UnmitigatedDamage, float, MitigatedDamage);
/**
*
*/
UCLASS()
class HWANYOUNG2_API UHYCharacAbilitySystemComponent : public UAbilitySystemComponent
{
GENERATED_BODY()
public:
bool CharacterAbilitiesGiven = false;
bool StartupEffectApplied = false;
FReceivedDamageDelegate ReceivedDamage;
//constructor
UHYCharacAbilitySystemComponent();
virtual void ReceiveDamage(UHYCharacAbilitySystemComponent* SourceASC, float UnmitigatedDamage, float MitigatedDamage);
};

View File

@ -0,0 +1,21 @@
#include "HYCharacGameplayAbility.h"
#include "AbilitySystemComponent.h"
UHYCharacGameplayAbility::UHYCharacGameplayAbility()
{
InstancingPolicy = EGameplayAbilityInstancingPolicy::InstancedPerActor;
ActivationBlockedTags.AddTag(FGameplayTag::RequestGameplayTag(FName("State.Dead")));
ActivationBlockedTags.AddTag(FGameplayTag::RequestGameplayTag(FName("State.Debuff.Stun")));
}
void UHYCharacGameplayAbility::OnAvatarSet(const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilitySpec& Spec)
{
Super::OnAvatarSet(ActorInfo, Spec);
if (ActivateAbilityOnGranted)
{
ActorInfo->AbilitySystemComponent->TryActivateAbility(Spec.Handle, false);
}
}

View File

@ -0,0 +1,32 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Abilities/GameplayAbility.h"
#include "hwanyoung2.h"
#include "HYCharacGameplayAbility.generated.h"
/**
*
*/
UCLASS()
class HWANYOUNG2_API UHYCharacGameplayAbility : public UGameplayAbility
{
GENERATED_BODY()
public:
UHYCharacGameplayAbility();
//Abilities with this set will automatically activate when the input is pressed:
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Ability")
EAbilityInputID AbilityInputID = EAbilityInputID::None;
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Ability")
EAbilityInputID AbilityID = EAbilityInputID::None;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Ability")
bool ActivateAbilityOnGranted = false;
virtual void OnAvatarSet(const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilitySpec& Spec) override;
};

View File

@ -0,0 +1,77 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "HYPlayerCharacAttributeSet.h"
#include "Net/UnrealNetwork.h"
UHYPlayerCharacAttributeSet::UHYPlayerCharacAttributeSet()
{
}
UHYPlayerCharacAttributeSet::~UHYPlayerCharacAttributeSet()
{
}
void UHYPlayerCharacAttributeSet::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME_CONDITION_NOTIFY(UHYPlayerCharacAttributeSet, PlayerLevel, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UHYPlayerCharacAttributeSet, Health, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UHYPlayerCharacAttributeSet, MaxHealth, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UHYPlayerCharacAttributeSet, Mana, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UHYPlayerCharacAttributeSet, MaxMana, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UHYPlayerCharacAttributeSet, Stamina, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UHYPlayerCharacAttributeSet, MaxStamina, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UHYPlayerCharacAttributeSet, GaugeP, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(UHYPlayerCharacAttributeSet, MaxGaugeP, COND_None, REPNOTIFY_Always);
}
void UHYPlayerCharacAttributeSet::OnRep_Level(const FGameplayAttributeData& OldPlayerLevel)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UHYPlayerCharacAttributeSet, PlayerLevel, OldPlayerLevel);
}
void UHYPlayerCharacAttributeSet::OnRep_Health(const FGameplayAttributeData& OldHealth)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UHYPlayerCharacAttributeSet, Health, OldHealth);
}
void UHYPlayerCharacAttributeSet::OnRep_MaxHealth(const FGameplayAttributeData& OldMaxHealth)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UHYPlayerCharacAttributeSet, MaxHealth, OldMaxHealth);
}
void UHYPlayerCharacAttributeSet::OnRep_Mana(const FGameplayAttributeData& OldMana)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UHYPlayerCharacAttributeSet, Mana, OldMana);
}
void UHYPlayerCharacAttributeSet::OnRep_MaxMana(const FGameplayAttributeData& OldMaxMana)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UHYPlayerCharacAttributeSet, MaxMana, OldMaxMana);
}
void UHYPlayerCharacAttributeSet::OnRep_GaugeP(const FGameplayAttributeData& OldGaugeP)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UHYPlayerCharacAttributeSet, GaugeP, OldGaugeP);
}
void UHYPlayerCharacAttributeSet::OnRep_MaxGaugeP(const FGameplayAttributeData& OldMaxGaugeP)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UHYPlayerCharacAttributeSet, MaxGaugeP, OldMaxGaugeP);
}
void UHYPlayerCharacAttributeSet::OnRep_Stamina(const FGameplayAttributeData& OldStamina)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UHYPlayerCharacAttributeSet, Stamina, OldStamina);
}
void UHYPlayerCharacAttributeSet::OnRep_MaxStamina(const FGameplayAttributeData& OldMaxStamina)
{
GAMEPLAYATTRIBUTE_REPNOTIFY(UHYPlayerCharacAttributeSet, MaxStamina, OldMaxStamina);
}

View File

@ -0,0 +1,117 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AttributeSet.h"
#include "AbilitySystemComponent.h"
#include "HYPlayerCharacAttributeSet.generated.h"
/**
*
*/
UCLASS()
class HWANYOUNG2_API UHYPlayerCharacAttributeSet : public UAttributeSet
{
GENERATED_BODY()
public:
UHYPlayerCharacAttributeSet(); //constructor
~UHYPlayerCharacAttributeSet(); //destructor
//when there are changes to any attributes, the attribute set needs to be replicated
//in order for other appropriate entities within the game level to be aware of such changes
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
UPROPERTY(BlueprintReadOnly, Category = "Player Level", ReplicatedUsing = OnRep_Level)
FGameplayAttributeData PlayerLevel;
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(UHYPlayerCharacAttributeSet, PlayerLevel)
GAMEPLAYATTRIBUTE_VALUE_GETTER(PlayerLevel)
GAMEPLAYATTRIBUTE_VALUE_SETTER(PlayerLevel)
GAMEPLAYATTRIBUTE_VALUE_INITTER(PlayerLevel)
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Health", ReplicatedUsing = OnRep_Health)
FGameplayAttributeData Health;
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(UHYPlayerCharacAttributeSet, Health)
GAMEPLAYATTRIBUTE_VALUE_GETTER(Health)
GAMEPLAYATTRIBUTE_VALUE_SETTER(Health)
GAMEPLAYATTRIBUTE_VALUE_INITTER(Health)
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Health", ReplicatedUsing = OnRep_MaxHealth)
FGameplayAttributeData MaxHealth;
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(UHYPlayerCharacAttributeSet, MaxHealth)
GAMEPLAYATTRIBUTE_VALUE_GETTER(MaxHealth)
GAMEPLAYATTRIBUTE_VALUE_SETTER(MaxHealth)
GAMEPLAYATTRIBUTE_VALUE_INITTER(MaxHealth)
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Mana", ReplicatedUsing = OnRep_Mana)
FGameplayAttributeData Mana;
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(UHYPlayerCharacAttributeSet, Mana)
GAMEPLAYATTRIBUTE_VALUE_GETTER(Mana)
GAMEPLAYATTRIBUTE_VALUE_SETTER(Mana)
GAMEPLAYATTRIBUTE_VALUE_INITTER(Mana)
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Mana", ReplicatedUsing = OnRep_MaxMana)
FGameplayAttributeData MaxMana;
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(UHYPlayerCharacAttributeSet, MaxMana)
GAMEPLAYATTRIBUTE_VALUE_GETTER(MaxMana)
GAMEPLAYATTRIBUTE_VALUE_SETTER(MaxMana)
GAMEPLAYATTRIBUTE_VALUE_INITTER(MaxMana)
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Ultimate Gauge Point", ReplicatedUsing = OnRep_GaugeP)
FGameplayAttributeData GaugeP;
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(UHYPlayerCharacAttributeSet, GaugeP)
GAMEPLAYATTRIBUTE_VALUE_GETTER(GaugeP)
GAMEPLAYATTRIBUTE_VALUE_SETTER(GaugeP)
GAMEPLAYATTRIBUTE_VALUE_INITTER(GaugeP)
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Ultimate Gauge Point", ReplicatedUsing = OnRep_MaxGaugeP)
FGameplayAttributeData MaxGaugeP;
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(UHYPlayerCharacAttributeSet, MaxGaugeP)
GAMEPLAYATTRIBUTE_VALUE_GETTER(MaxGaugeP)
GAMEPLAYATTRIBUTE_VALUE_SETTER(MaxGaugeP)
GAMEPLAYATTRIBUTE_VALUE_INITTER(MaxGaugeP)
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stamina", ReplicatedUsing = OnRep_Stamina)
FGameplayAttributeData Stamina;
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(UHYPlayerCharacAttributeSet, Stamina)
GAMEPLAYATTRIBUTE_VALUE_GETTER(Stamina)
GAMEPLAYATTRIBUTE_VALUE_SETTER(Stamina)
GAMEPLAYATTRIBUTE_VALUE_INITTER(Stamina)
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stamina", ReplicatedUsing = OnRep_MaxStamina)
FGameplayAttributeData MaxStamina;
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(UHYPlayerCharacAttributeSet, MaxStamina)
GAMEPLAYATTRIBUTE_VALUE_GETTER(MaxStamina)
GAMEPLAYATTRIBUTE_VALUE_SETTER(MaxStamina)
GAMEPLAYATTRIBUTE_VALUE_INITTER(MaxStamina)
UFUNCTION()
virtual void OnRep_Level(const FGameplayAttributeData& OldPlayerLevel);
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);
UFUNCTION()
virtual void OnRep_GaugeP(const FGameplayAttributeData& OldGaugeP);
UFUNCTION()
virtual void OnRep_MaxGaugeP(const FGameplayAttributeData& OldMaxGaugeP);
UFUNCTION()
virtual void OnRep_Stamina(const FGameplayAttributeData& OldStamina);
UFUNCTION()
virtual void OnRep_MaxStamina(const FGameplayAttributeData& OldMaxStamina);
};

View File

@ -0,0 +1,9 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "HYPlayerCharacController.h"
void AHYPlayerCharacController::OnPossess(APawn* InPawn)
{
}

View File

@ -0,0 +1,19 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "HYPlayerCharacController.generated.h"
/**
*
*/
UCLASS()
class HWANYOUNG2_API AHYPlayerCharacController : public APlayerController
{
GENERATED_BODY()
protected:
virtual void OnPossess(APawn* InPawn) override;
};

View File

@ -0,0 +1,207 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "HYPlayerState.h"
#include "HYCharacAbilitySystemComponent.h"
#include "HYPlayerCharacAttributeSet.h"
AHYPlayerState::AHYPlayerState()
{
AbilitySystemComponent =
CreateDefaultSubobject<UHYCharacAbilitySystemComponent>(
TEXT("AbilitySystemComponent"));
AbilitySystemComponent->SetIsReplicated(true);
//we do mixed because we only need to replicate gameplay cues
//which are responsible for visual stuff
AbilitySystemComponent->SetReplicationMode(
EGameplayEffectReplicationMode::Mixed);
AttributeSetBase =
CreateDefaultSubobject<UHYPlayerCharacAttributeSet>(
TEXT("AttributeSetBase"));
NetUpdateFrequency = 100.0f;
DeadTag = FGameplayTag::RequestGameplayTag(FName("State.Dead"));
}
UAbilitySystemComponent* AHYPlayerState::GetAbilitySystemComponent() const
{
return AbilitySystemComponent;
}
UHYPlayerCharacAttributeSet* AHYPlayerState::GetAttributeSetBase() const
{
return AttributeSetBase;
}
bool AHYPlayerState::IsAlive() const
{
return GetHealth() > 0.0f;
}
void AHYPlayerState::ShowAbilityConfirmCancelText(bool showText)
{
}
float AHYPlayerState::GetHealth() const
{
return AttributeSetBase->GetHealth();
}
float AHYPlayerState::GetMaxHealth() const
{
return AttributeSetBase->GetMaxHealth();
}
float AHYPlayerState::GetMana() const
{
return AttributeSetBase->GetMana();
}
float AHYPlayerState::GetMaxMana() const
{
return AttributeSetBase->GetMaxMana();
}
float AHYPlayerState::GetStamina() const
{
return AttributeSetBase->GetStamina();
}
float AHYPlayerState::GetMaxStamina() const
{
return AttributeSetBase->GetMaxStamina();
}
float AHYPlayerState::GetGaugeP() const
{
return AttributeSetBase->GetGaugeP();
}
float AHYPlayerState::GetMaxGaugeP() const
{
return AttributeSetBase->GetGaugeP();
}
float AHYPlayerState::GetPlayerLevel() const
{
return AttributeSetBase->GetPlayerLevel();
}
void AHYPlayerState::BeginPlay()
{
Super::BeginPlay();
if (AbilitySystemComponent)
{
//what we are doing here is creating a "link"
//between the attribute change event and the function.
//we will do this for all attribute change delegate handlers
HPChangedDelegateHandle =
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(
AttributeSetBase->GetHealthAttribute()).AddUObject(
this, &AHYPlayerState::HealthChanged);
MaxHPChangedDelegateHandle =
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(
AttributeSetBase->GetMaxHealthAttribute()).AddUObject(
this, &AHYPlayerState::MaxHealthChanged);
MPChangedDelegateHandle =
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(
AttributeSetBase->GetManaAttribute()).AddUObject(
this, &AHYPlayerState::ManaChanged);
MaxMPChangedDelegateHandle =
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(
AttributeSetBase->GetMaxManaAttribute()).AddUObject(
this, &AHYPlayerState::MaxManaChanged);
StaminaChangedDelegateHandle =
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(
AttributeSetBase->GetStaminaAttribute()).AddUObject(
this, &AHYPlayerState::StaminaChanged);
MaxStaminaChangedDelegateHandle =
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(
AttributeSetBase->GetMaxStaminaAttribute()).AddUObject(
this, &AHYPlayerState::MaxStaminaChanged);
GaugePChangedDelegateHandle =
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(
AttributeSetBase->GetGaugePAttribute()).AddUObject(
this, &AHYPlayerState::GaugePChanged);
MaxGaugePChangedDelegateHandle =
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(
AttributeSetBase->GetMaxGaugePAttribute()).AddUObject(
this, &AHYPlayerState::MaxGaugePChanged);
CharacterLevelChangedDelegateHandle =
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(
AttributeSetBase->GetPlayerLevelAttribute()).AddUObject(
this, &AHYPlayerState::PlayerLevelChanged);
//here we are making a custom gameplay tag event for State.Debuff.Stun
AbilitySystemComponent->RegisterGameplayTagEvent(FGameplayTag::RequestGameplayTag(
FName("State.Debuff.Stun")), EGameplayTagEventType::NewOrRemoved).AddUObject(
this, &AHYPlayerState::StunTagChanged);
}
}
void AHYPlayerState::HealthChanged(const FOnAttributeChangeData& Data)
{
UE_LOG(LogTemp, Warning, TEXT("Health changed!"));
}
void AHYPlayerState::MaxHealthChanged(const FOnAttributeChangeData& Data)
{
UE_LOG(LogTemp, Warning, TEXT("Max Health changed!"));
}
void AHYPlayerState::ManaChanged(const FOnAttributeChangeData& Data)
{
UE_LOG(LogTemp, Warning, TEXT("Mana changed!"));
}
void AHYPlayerState::MaxManaChanged(const FOnAttributeChangeData& Data)
{
UE_LOG(LogTemp, Warning, TEXT("Max Mana changed!"));
}
void AHYPlayerState::StaminaChanged(const FOnAttributeChangeData& Data)
{
UE_LOG(LogTemp, Warning, TEXT("Stamina changed!"));
}
void AHYPlayerState::MaxStaminaChanged(const FOnAttributeChangeData& Data)
{
UE_LOG(LogTemp, Warning, TEXT("Max Stamina changed!"));
}
void AHYPlayerState::GaugePChanged(const FOnAttributeChangeData& Data)
{
UE_LOG(LogTemp, Warning, TEXT("Gauge Point changed!"));
}
void AHYPlayerState::MaxGaugePChanged(const FOnAttributeChangeData& Data)
{
UE_LOG(LogTemp, Warning, TEXT("Max Gauge Point changed!"));
}
void AHYPlayerState::PlayerLevelChanged(const FOnAttributeChangeData& Data)
{
UE_LOG(LogTemp, Warning, TEXT("Player Level changed!"));
}
void AHYPlayerState::StunTagChanged(const FGameplayTag CallbackTag, int32 NewCount)
{
if (NewCount > 0)
{
FGameplayTagContainer AbilityTagsToCancel;
AbilityTagsToCancel.AddTag(FGameplayTag::RequestGameplayTag(FName("Ability")));
FGameplayTagContainer AbilityTagsToIgnore;
AbilityTagsToIgnore.AddTag(FGameplayTag::RequestGameplayTag(
FName("Ability.NotCanceledByStun")));
AbilitySystemComponent->CancelAbilities(
&AbilityTagsToCancel, &AbilityTagsToCancel);
}
}

View File

@ -0,0 +1,94 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemInterface.h"
#include "GameplayTagContainer.h"
#include "GameplayEffectTypes.h"
#include "GameFramework/PlayerState.h"
#include "HYPlayerState.generated.h"
/**
*
*/
UCLASS()
class HWANYOUNG2_API AHYPlayerState : public APlayerState, public IAbilitySystemInterface
{
GENERATED_BODY()
public:
AHYPlayerState();
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
class UHYPlayerCharacAttributeSet* GetAttributeSetBase() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State")
bool IsAlive() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State|UI")
void ShowAbilityConfirmCancelText(bool showText);
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State|Attributes")
float GetHealth() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State|Attributes")
float GetMaxHealth() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State|Attributes")
float GetMana() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State|Attributes")
float GetMaxMana() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State|Attributes")
float GetStamina() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State|Attributes")
float GetMaxStamina() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State|Attributes")
float GetGaugeP() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State|Attributes")
float GetMaxGaugeP() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Player State|Attributes")
float GetPlayerLevel() const;
protected:
UPROPERTY()
class UHYCharacAbilitySystemComponent* AbilitySystemComponent;
UPROPERTY()
class UHYPlayerCharacAttributeSet* AttributeSetBase;
FGameplayTag DeadTag;
FDelegateHandle HPChangedDelegateHandle;
FDelegateHandle MaxHPChangedDelegateHandle;
FDelegateHandle MPChangedDelegateHandle;
FDelegateHandle MaxMPChangedDelegateHandle;
FDelegateHandle StaminaChangedDelegateHandle;
FDelegateHandle MaxStaminaChangedDelegateHandle;
FDelegateHandle GaugePChangedDelegateHandle;
FDelegateHandle MaxGaugePChangedDelegateHandle;
FDelegateHandle CharacterLevelChangedDelegateHandle;
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);
virtual void StaminaChanged(const FOnAttributeChangeData& Data);
virtual void MaxStaminaChanged(const FOnAttributeChangeData& Data);
virtual void GaugePChanged(const FOnAttributeChangeData& Data);
virtual void MaxGaugePChanged(const FOnAttributeChangeData& Data);
virtual void PlayerLevelChanged(const FOnAttributeChangeData& Data);
virtual void StunTagChanged(const FGameplayTag CallbackTag, int32 NewCount);
};

View File

@ -0,0 +1,12 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "HwanyoungAssetManager.h"
#include "AbilitySystemGlobals.h"
void UHwanyoungAssetManager::StartInitialLoading()
{
Super::StartInitialLoading();
UAbilitySystemGlobals::Get().InitGlobalData();
UE_LOG(LogTemp, Warning, TEXT("Hello World!!"));
}

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 "HwanyoungAssetManager.generated.h"
/**
*
*/
UCLASS()
class HWANYOUNG2_API UHwanyoungAssetManager : public UAssetManager
{
GENERATED_BODY()
public:
virtual void StartInitialLoading() override;
};

View File

@ -0,0 +1,14 @@
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class hwanyoung2 : ModuleRules
{
public hwanyoung2(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "EnhancedInput" });
PrivateDependencyModuleNames.AddRange(new string[] { "GameplayAbilities", "GameplayTags", "GameplayTasks" });
}
}

View File

@ -0,0 +1,7 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "hwanyoung2.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, hwanyoung2, "hwanyoung2" );

View File

@ -0,0 +1,20 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
UENUM(BlueprintType)
enum class EAbilityInputID : uint8
{
None UMETA(DisplayName = "None"), //no input given
Confirm UMETA(DisplayName = "Confirm"),
Cancel UMETA(DisplayName = "Cancel"),
UseWeapon UMETA(DisplayName = "Use Weapon"), //using melee weapon to attack
SwitchWeapon UMETA(DisplayName = "Switch Weapons"), //switching weapons
UseActive1 UMETA(DisplayName = "Use Active Skill 1"), //active 1
UseActive2 UMETA(DisplayName = "Use Active Skill 2"), //active 2
UseActive3 UMETA(DisplayName = "Use Active Skill 3"), //active 3
UseUlt UMETA(DisplayName = "Use Ultimate Skill"), //ult
PassiveDash UMETA(DisplayName = "Dash") //dash (passive)
};

View File

@ -0,0 +1,463 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "hwanyoung2Character.h"
#include "HYCharacAbilitySystemComponent.h"
#include "HYPlayerCharacAttributeSet.h"
#include "HYCharacGameplayAbility.h"
#include "Camera/CameraComponent.h"
#include "Components/CapsuleComponent.h"
#include "Components/InputComponent.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "GameFramework/Controller.h"
#include "GameFramework/SpringArmComponent.h"
#include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h"
//////////////////////////////////////////////////////////////////////////
// Ahwanyoung2Character
float Ahwanyoung2Character::GetGaugeP() const
{
if (AttributeSetBase.IsValid())
{
return AttributeSetBase->GetGaugeP();
}
return 0.0f;
}
float Ahwanyoung2Character::GetMaxGaugeP() const
{
if (AttributeSetBase.IsValid())
{
return AttributeSetBase->GetMaxGaugeP();
}
return 0.0f;
}
Ahwanyoung2Character::Ahwanyoung2Character()
{
// Set size for collision capsule
GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
// Don't rotate when the controller rotates. Let that just affect the camera.
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = false;
bUseControllerRotationRoll = false;
// Configure character movement
GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...
GetCharacterMovement()->RotationRate = FRotator(0.0f, 500.0f, 0.0f); // ...at this rotation rate
// Note: For faster iteration times these variables, and many more, can be tweaked in the Character Blueprint
// instead of recompiling to adjust them
GetCharacterMovement()->JumpZVelocity = 700.f;
GetCharacterMovement()->AirControl = 0.35f;
GetCharacterMovement()->MaxWalkSpeed = 500.f;
GetCharacterMovement()->MinAnalogWalkSpeed = 20.f;
GetCharacterMovement()->BrakingDecelerationWalking = 2000.f;
// Create a camera boom (pulls in towards the player if there is a collision)
CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
CameraBoom->SetupAttachment(RootComponent);
CameraBoom->TargetArmLength = 400.0f; // The camera follows at this distance behind the character
CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller
// Create a follow camera
FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
FollowCamera->SetupAttachment(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
FollowCamera->bUsePawnControlRotation = false; // Camera does not rotate relative to arm
// Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character)
// are set in the derived blueprint asset named ThirdPersonCharacter (to avoid direct content references in C++)
}
Ahwanyoung2Character::Ahwanyoung2Character(const FObjectInitializer& ObjectInitializer):
Super(ObjectInitializer.SetDefaultSubobjectClass<UCharacterMovementComponent>(
ACharacter::CharacterMovementComponentName))
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
//setting up the capsule collider object for the character:
GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Visibility,
ECollisionResponse::ECR_Overlap);
bAlwaysRelevant = true;
DeadTag = FGameplayTag::RequestGameplayTag(FName("State.Dead"));
EffectRemoveOnDeathTag = FGameplayTag::RequestGameplayTag(FName("State.RemoveOnDeath"));
}
void Ahwanyoung2Character::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
//In the server:
if (AbilitySystemComponent != NULL) {
AbilitySystemComponent->InitAbilityActorInfo(this, this); // who is the avatar?
}
SetOwner(this);
InitializeAttributes();
AddCharacterAbilities();
}
void Ahwanyoung2Character::OnRep_PlayerState()
{
Super::OnRep_PlayerState();
//The same business with intializing:
AbilitySystemComponent->InitAbilityActorInfo(this, this);
InitializeAttributes();
//Key binding:
if (AbilitySystemComponent != 0 && InputComponent) {
const FGameplayAbilityInputBinds Binds("Confirm", "Cancel", "EAbilityInputID",
static_cast<int32>(EAbilityInputID::Confirm), static_cast<int32>(EAbilityInputID::Cancel));
AbilitySystemComponent->BindAbilityActivationToInputComponent(InputComponent, Binds);
}
}
UAbilitySystemComponent* Ahwanyoung2Character::GetAbilitySystemComponent() const
{
return AbilitySystemComponent.Get();
}
float Ahwanyoung2Character::GetStartingCameraBoomArmLength()
{
return 0.0f;
}
FVector Ahwanyoung2Character::GetStartingCameraBoomLocation()
{
return FVector();
}
void Ahwanyoung2Character::BeginPlay()
{
// Call the base class
Super::BeginPlay();
//Add Input Mapping Context
if (APlayerController* PlayerController = Cast<APlayerController>(Controller))
{
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer()))
{
Subsystem->AddMappingContext(DefaultMappingContext, 0);
}
}
}
//////////////////////////////////////////////////////////////////////////
// Input
void Ahwanyoung2Character::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
{
// Set up action bindings
if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(PlayerInputComponent)) {
//Jumping
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Triggered, this, &ACharacter::Jump);
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);
//Moving
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &Ahwanyoung2Character::Move);
//Looking
EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &Ahwanyoung2Character::Look);
}
}
void Ahwanyoung2Character::Move(const FInputActionValue& Value)
{
// input is a Vector2D
FVector2D MovementVector = Value.Get<FVector2D>();
if (Controller != nullptr)
{
// find out which way is forward
const FRotator Rotation = Controller->GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
// get forward vector
const FVector ForwardDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
// get right vector
const FVector RightDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
// add movement
AddMovementInput(ForwardDirection, MovementVector.Y);
AddMovementInput(RightDirection, MovementVector.X);
}
}
void Ahwanyoung2Character::Look(const FInputActionValue& Value)
{
// input is a Vector2D
FVector2D LookAxisVector = Value.Get<FVector2D>();
if (Controller != nullptr)
{
// add yaw and pitch input to controller
AddControllerYawInput(LookAxisVector.X);
AddControllerPitchInput(LookAxisVector.Y);
}
}
bool Ahwanyoung2Character::IsAlive() const
{
return GetHealth() > 0.0f;
}
int32 Ahwanyoung2Character::GetAbilityLevel(EAbilityInputID AbilityID) const
{
return int32();
}
void Ahwanyoung2Character::RemoveCharacterAbilities()
{
//if the object doesn't have the authority, ability system component is not valid
//or character abilities are not given in the ability system component,
//we don't do anything and just return
if (GetLocalRole() != ROLE_Authority ||
!AbilitySystemComponent.IsValid() ||
!AbilitySystemComponent->CharacterAbilitiesGiven)
{
return;
}
TArray<FGameplayAbilitySpecHandle> AbilitiesToRemove;
for (const FGameplayAbilitySpec& Spec : AbilitySystemComponent->GetActivatableAbilities())
{
if (Spec.SourceObject == this && CharacterAbilities.Contains(Spec.Ability->GetClass()))
{
AbilitiesToRemove.Add(Spec.Handle); //spec.handle is an instance of the ability
}
}
for (int32 i = 0; i < AbilitiesToRemove.Num(); i++)
{
AbilitySystemComponent->ClearAbility(AbilitiesToRemove[i]);
}
AbilitySystemComponent->CharacterAbilitiesGiven = false;
}
void Ahwanyoung2Character::Die()
{
RemoveCharacterAbilities();
GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
GetCharacterMovement()->GravityScale = 0;
GetCharacterMovement()->Velocity = FVector(0); //disabling character movement when death
OnCharacterDied.Broadcast(this);
if (AbilitySystemComponent.IsValid())
{
AbilitySystemComponent->CancelAbilities();
FGameplayTagContainer EffectsTagsToRemove;
EffectsTagsToRemove.AddTag(EffectRemoveOnDeathTag);
int32 NumEffectsRemoved = AbilitySystemComponent->RemoveActiveEffectsWithTags(EffectsTagsToRemove);
AbilitySystemComponent->AddLooseGameplayTag(DeadTag);
}
//playing death anim:
if (DeathMontage)
{
PlayAnimMontage(DeathMontage);
}
else
{
FinishDying();
}
}
void Ahwanyoung2Character::FinishDying()
{
Destroy();
}
float Ahwanyoung2Character::GetPlayerLevel() const
{
if (AttributeSetBase.IsValid())
{
return AttributeSetBase->GetPlayerLevel();
}
return 0.0f;
}
float Ahwanyoung2Character::GetHealth() const
{
if (AttributeSetBase.IsValid())
{
return AttributeSetBase->GetHealth();
}
return 0.0f;
}
float Ahwanyoung2Character::GetMaxHealth() const
{
if (AttributeSetBase.IsValid())
{
return AttributeSetBase->GetMaxHealth();
}
return 0.0f;
}
float Ahwanyoung2Character::GetMana() const
{
if (AttributeSetBase.IsValid())
{
return AttributeSetBase->GetMana();
}
return 0.0f;
}
float Ahwanyoung2Character::GetMaxMana() const
{
if (AttributeSetBase.IsValid())
{
return AttributeSetBase->GetMaxMana();
}
return 0.0f;
}
float Ahwanyoung2Character::GetStamina() const
{
if (AttributeSetBase.IsValid())
{
return AttributeSetBase->GetStamina();
}
return 0.0f;
}
float Ahwanyoung2Character::GetMaxStamina() const
{
if (AttributeSetBase.IsValid())
{
return AttributeSetBase->GetMaxStamina();
}
return 0.0f;
}
void Ahwanyoung2Character::AddCharacterAbilities()
{
if (GetLocalRole() != ROLE_Authority ||
!AbilitySystemComponent.IsValid() ||
AbilitySystemComponent->CharacterAbilitiesGiven)
{
return;
}
//if there are no abilities added to the character:
for (TSubclassOf<UHYCharacGameplayAbility>& StartUpAbility : CharacterAbilities)
{
AbilitySystemComponent->GiveAbility(
FGameplayAbilitySpec(StartUpAbility,
GetAbilityLevel(StartUpAbility.GetDefaultObject()->AbilityID),
static_cast<int32> (StartUpAbility.GetDefaultObject()->AbilityInputID),
this));
}
}
void Ahwanyoung2Character::InitializeAttributes()
{
if (!AbilitySystemComponent.IsValid())
{
return;
}
if (!DefaultAttributes)
{
UE_LOG(LogTemp, Error,
TEXT("%s() Missing DefaultAttributes for %s. Please fill in the character's Blueprint."),
*FString(__FUNCTION__), *GetName());
return;
}
FGameplayEffectContextHandle EffectContext = AbilitySystemComponent->MakeEffectContext();
EffectContext.AddSourceObject(this);
FGameplayEffectSpecHandle NewHandle = AbilitySystemComponent->
MakeOutgoingSpec(DefaultAttributes, GetPlayerLevel(), EffectContext);
if (NewHandle.IsValid())
{
//apply the gameplayeffect here:
FActiveGameplayEffectHandle ActiveGEHandle = AbilitySystemComponent->ApplyGameplayEffectSpecToTarget(
*NewHandle.Data.Get(), AbilitySystemComponent.Get());
}
}
void Ahwanyoung2Character::AddStartupEffects()
{
if (GetLocalRole() != ROLE_Authority ||
!AbilitySystemComponent.IsValid() ||
AbilitySystemComponent->StartupEffectApplied)
{
return;
}
FGameplayEffectContextHandle EffectContext = AbilitySystemComponent->MakeEffectContext();
EffectContext.AddSourceObject(this);
for (TSubclassOf<UGameplayEffect> GameplayEffect : StartupEffects)
{
FGameplayEffectSpecHandle NewHandle = AbilitySystemComponent->MakeOutgoingSpec(GameplayEffect, GetPlayerLevel(), EffectContext);
if (NewHandle.IsValid())
{
FActiveGameplayEffectHandle ActiveGEHandle =
AbilitySystemComponent->ApplyGameplayEffectSpecToTarget(
*NewHandle.Data.Get(), AbilitySystemComponent.Get());
}
}
AbilitySystemComponent->StartupEffectApplied = true;
}
void Ahwanyoung2Character::SetHealth(float Health)
{
if (AttributeSetBase.IsValid())
{
AttributeSetBase->SetHealth(Health);
}
}
void Ahwanyoung2Character::SetMana(float Mana)
{
if (AttributeSetBase.IsValid())
{
AttributeSetBase->SetMana(Mana);
}
}
void Ahwanyoung2Character::SetStamina(float Stamina)
{
if (AttributeSetBase.IsValid())
{
AttributeSetBase->SetStamina(Stamina);
}
}
void Ahwanyoung2Character::SetGaugeP(float GaugeP)
{
if (AttributeSetBase.IsValid())
{
AttributeSetBase->SetGaugeP(GaugeP);
}
}

View File

@ -0,0 +1,192 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "InputActionValue.h"
#include "AbilitySystemInterface.h" //allows defining an interface for ability system
#include "GameplayEffectTypes.h"
#include "GameplayTagContainer.h"
#include "hwanyoung2.h"
#include "hwanyoung2Character.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCharacterDiedDelegate,
Ahwanyoung2Character*, Character);
UCLASS(config=Game)
class Ahwanyoung2Character : public ACharacter, public IAbilitySystemInterface
{
GENERATED_BODY()
/** Camera boom positioning the camera behind the character */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
class USpringArmComponent* CameraBoom;
/** Follow camera */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
class UCameraComponent* FollowCamera;
/** MappingContext */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputMappingContext* DefaultMappingContext;
/** Jump Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* JumpAction;
/** Move Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* MoveAction;
/** Look Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* LookAction;
public:
UPROPERTY(BlueprintAssignable, Category = "Hwanyoung|Character")
FCharacterDiedDelegate OnCharacterDied;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Character")
virtual bool IsAlive() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Character")
virtual int32 GetAbilityLevel(EAbilityInputID AbilityID) const;
//this function is called only in the server:
virtual void RemoveCharacterAbilities();
//this is also called only in the server:
virtual void Die();
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Character")
virtual void FinishDying();
//attribute getter functions
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Attributes")
float GetPlayerLevel() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Attributes")
float GetHealth() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Atributes")
float GetMaxHealth() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Attributes")
float GetMana() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Atributes")
float GetMaxMana() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Attributes")
float GetStamina() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Atributes")
float GetMaxStamina() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Attributes")
float GetGaugeP() const;
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Atributes")
float GetMaxGaugeP() const;
Ahwanyoung2Character();
Ahwanyoung2Character(const class FObjectInitializer& ObjectInitializer);
//Updates the AbilitysystemComponent's actorInfo, especially in a multiplayer environment
//Gets called on the server (so basically my end)
virtual void PossessedBy(AController* NewController) override;
//Gets called on the client (their end)
virtual void OnRep_PlayerState() override;
//getter function for ability system component:
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
UFUNCTION(BlueprintCallable, Category = "HY_Character|Camera")
float GetStartingCameraBoomArmLength();
UFUNCTION(BlueprintCallable, Category = "HY_Character|Camera")
FVector GetStartingCameraBoomLocation();
protected:
//pointers to the attribute set and ability system component
//of the player character
/** Our ability system */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Abilities, meta = (AllowPrivateAccess = "true"))
TWeakObjectPtr<class UHYCharacAbilitySystemComponent> AbilitySystemComponent;
UPROPERTY()
TWeakObjectPtr<class UHYPlayerCharacAttributeSet> AttributeSetBase;
UPROPERTY(BlueprintReadOnly, Category = "HY_Character|Camera")
float StartingCameraBoomArmLength;
UPROPERTY(BlueprintReadOnly, Category = "HY_Character|Camera")
FVector StartingCameraBoomLocation;
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "HY_Character|Camera")
float BaseTurnRate = 45.0f;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "HY_Character|Camera")
float BaseLookUpRate = 45.0f;
/*UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "HY_Character|Camera")
class USpringArmComponent* CameraBoom;
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "HY_Character|Camera")
class UCameraComponent* FollowCamera;*/
//gameplaytags represent the states of the object;
//so if we were to modify the gameplay tags of a character,
//we are, comprehensively speaking, changing the states of
//the given character
FGameplayTag DeadTag;
FGameplayTag EffectRemoveOnDeathTag;
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Hwanyoung|Character")
FText CharacterName;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Hwanyoung|Animation")
UAnimMontage* DeathMontage;
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Hwanyoung|Abilties")
TSubclassOf<class UGameplayEffect> DefaultAttributes;
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Hwanyoung|Abilities")
TArray<TSubclassOf<class UGameplayEffect>> StartupEffects;
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Hwanyoung|Abilities")
TArray<TSubclassOf<class UHYCharacGameplayAbility>> CharacterAbilities;
virtual void AddCharacterAbilities();
virtual void InitializeAttributes();
virtual void AddStartupEffects();
//these two functions are going to be used
//when re/spawn; changes to these attributes mid-gameplay
//are going to be calculated via GameplayEffects
virtual void SetHealth(float Health);
virtual void SetMana(float Mana);
virtual void SetStamina(float Stamina);
virtual void SetGaugeP(float GaugeP);
/** Called for movement input */
void Move(const FInputActionValue& Value);
/** Called for looking input */
void Look(const FInputActionValue& Value);
protected:
// APawn interface
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
// To add mapping context
virtual void BeginPlay();
public:
/** Returns CameraBoom subobject **/
class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
/** Returns FollowCamera subobject **/
class UCameraComponent* GetFollowCamera() const { return FollowCamera; }
};

View File

@ -0,0 +1,15 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "hwanyoung2GameMode.h"
#include "hwanyoung2Character.h"
#include "UObject/ConstructorHelpers.h"
Ahwanyoung2GameMode::Ahwanyoung2GameMode()
{
// set default pawn class to our Blueprinted character
static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/ThirdPerson/Blueprints/BP_ThirdPersonCharacter"));
if (PlayerPawnBPClass.Class != NULL)
{
DefaultPawnClass = PlayerPawnBPClass.Class;
}
}

View File

@ -0,0 +1,19 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "hwanyoung2GameMode.generated.h"
UCLASS(minimalapi)
class Ahwanyoung2GameMode : public AGameModeBase
{
GENERATED_BODY()
public:
Ahwanyoung2GameMode();
};

View File

@ -0,0 +1,15 @@
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
public class hwanyoung2EditorTarget : TargetRules
{
public hwanyoung2EditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.V2;
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
ExtraModuleNames.Add("hwanyoung2");
}
}