1. Native Parent Class
๋ผ์ด๋ผ์๋ ๋ค์ํ ๊ฒฝํ๊ณผ ๋ ๋ฒจ์ด ์๋ ๋งํผ ๊ฐ๊ฐ ๋ค๋ฅธ Pawn์ ์ฌ์ฉํ๊ณ ์๋ค. ๋ณดํต Pawn๋ค์ ๋ฐ๋ก ๊ฐ๋ฐ๋๋ ๊ฒ์ด ์๋ ํ๋์ ํด๋์ค์์ ํ์๋์ด ๊ทธ ๋ถ๋ชจ ํด๋์ค๋ฅผ ์์๋ฐ๊ณ ํน์ฑ์ด ๋ฐ๋ผ ์์ ํด๋์ค ์์์ ๋ค๋ฅด๊ฒ ๊ฐ๋ฐ๋๊ฒ ๋๋ค.
์ด๋ฌํ Pawn๋ค์ Native Parent Class๋ ๋ฐ๋ก LyraCharacter์ด๋ค.
์ฌ๊ธฐ์ Native Parent Class๋ C++์ ์ ์๋ ๋ถ๋ชจ ํด๋์ค์ด๋ค. ๋ง์ฝ A ๋ธ๋ฃจํ๋ฆฐํธ ํด๋์ค๋ฅผ ๋ค๋ฅธ B ๋ธ๋ฃจํ๋ฆฐํธ ํด๋์ค์์ ํ์ํ ๊ฒฝ์ฐ, A์ ๋ถ๋ชจ ํด๋์ค๋ B ๋ธ๋ฃจํ๋ฆฐํธ ํด๋์ค๋ก ๋ฌ๋ผ์ง ์ ์์ง๋ง Native Parent Class๋ ์ฌ์ ํ B์ Native Parent Class๋ฅผ ๋ฐ๋ผ๊ฐ ๊ฒ์ด๋ค.
2. LyraCharacter
LyraCharacter๋ฅผ ์ค๋ช ํ๋ ์ฃผ์์ ๋ค์๊ณผ ๊ฐ๋ค.
/**
* ALyraCharacter
*
* The base character pawn class used by this project.
* Responsible for sending events to pawn components.
* New behavior should be added via pawn components when possible.
*/
์ฆ, ๋ผ์ด๋ผ ํ๋ก์ ํธ์์ ์ฌ์ฉ๋๋ base character pawn class์ด๋ค. ์ํ ํ๋ก์ ํธ์ด๊ธฐ๋ ํ์ง๋ง, ์ค์ ํ๋ก์ ํธ์ ์ ์ฉ ๊ฐ๋ฅํ๋๋ก ์ ์๋์๋ค๋๋ฐ ์ด ์ ์ ๋งํ๋ ๊ฒ ๊ฐ๋ค.
๋ค์์ LyraCharacter ํค๋ ํ์ผ์ ์ผ๋ถ๋ถ์ด๋ค.
UCLASS(Config = Game, Meta = (ShortTooltip = "The base character pawn class used by this project."))
class LYRAGAME_API ALyraCharacter : public AModularCharacter, public IAbilitySystemInterface, public IGameplayCueInterface, public IGameplayTagAssetInterface, public ILyraTeamAgentInterface
{
GENERATED_BODY()
public:
ALyraCharacter(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
UFUNCTION(BlueprintCallable, Category = "Lyra|Character")
ALyraPlayerController* GetLyraPlayerController() const;
UFUNCTION(BlueprintCallable, Category = "Lyra|Character")
ALyraPlayerState* GetLyraPlayerState() const;
UFUNCTION(BlueprintCallable, Category = "Lyra|Character")
ULyraAbilitySystemComponent* GetLyraAbilitySystemComponent() const;
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
virtual void GetOwnedGameplayTags(FGameplayTagContainer& TagContainer) const override;
virtual bool HasMatchingGameplayTag(FGameplayTag TagToCheck) const override;
virtual bool HasAllMatchingGameplayTags(const FGameplayTagContainer& TagContainer) const override;
virtual bool HasAnyMatchingGameplayTags(const FGameplayTagContainer& TagContainer) const override;
private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lyra|Character", Meta = (AllowPrivateAccess = "true"))
TObjectPtr<ULyraPawnExtensionComponent> PawnExtComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lyra|Character", Meta = (AllowPrivateAccess = "true"))
TObjectPtr<ULyraHealthComponent> HealthComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lyra|Character", Meta = (AllowPrivateAccess = "true"))
TObjectPtr<ULyraCameraComponent> CameraComponent;
UPROPERTY(Transient, ReplicatedUsing = OnRep_ReplicatedAcceleration)
FLyraReplicatedAcceleration ReplicatedAcceleration;
UPROPERTY(ReplicatedUsing = OnRep_MyTeamID)
FGenericTeamId MyTeamID;
UPROPERTY()
FOnLyraTeamIndexChangedDelegate OnTeamChangedDelegate;
};
LyraCharacter ๊ธฐ๋ฐ ๋ธ๋ฃจํ๋ฆฐํธ ํด๋์ค์ธ Character_Default์ ํจ๊ป ์ดํด๋ณด๋ฉด, ํน์ ์กํฐ์ธ Character๋ฅผ ์์ฑํ์ ๋์ ๋ค๋ฅด๊ฒ ๋ค๋ฅธ ์ปดํฌ๋ํธ๋ ํจ๊ป ์๋ ๊ฒ์ ํ์ธํ ์ ์๋ค.
์ถ๊ฐ๋ ์ปดํฌ๋ํธ ์ค ๋ธ๋ฃจํ๋ฆฐํธ์์ ํ์ธํ ์ ์๋ ๊ฒ์ ์ธ ๊ฐ์ง์ด๋ค.
- PawnExtComponent
- ULyraPawnExtensionComponent ํด๋์ค
- ์ด๊ธฐํ ์ ์ฌ์ฉ
- HealthComponent
- ULyraHealthComponent ํด๋์ค
- ์บ๋ฆญํฐ์ ์ฒด๋ ฅ ๋ ธ์ถ ๋ฐ ์ฌ๋ง ์ฒ๋ฆฌ
- CameraComponent
- ULyraCameraComponent ํด๋์ค
- ์นด๋ฉ๋ผ
- ๊ฒ์์ ๋ฐ๋ผ ๋ค์ํ ์นด๋ฉ๋ผ๋ฅผ ๋ถ์ผ ์ ์์
๋งคํฌ๋ก ์ธ์ ๊ฐ์ผ๋ก BlueprintReadOnly์ด ์ค์ ๋์ด ์์ด ๊ฐ๋ฅํ๋ค.
์์ฑ, ์ฒด๋ ฅ, ์นด๋ฉ๋ผ ๋ฑ ๊ธฐ๋ณธ์ ์ผ๋ก ์บ๋ฆญํฐ์ ์์ด์ผ ํ๋ ์ปดํฌ๋ํธ๋ Native Parent Class์ ๊ตฌํ๋์ด ์๋ค. ์ด ์ธ์ ๊ฒ์์ ํน์ง์ ๋ฐ๋ผ ์ปดํฌ๋ํธ์ ์ถ๊ฐํ๋ฉฐ ๊ฐ๋ฐ์ด ๊ฐ๋ฅํ ๊ฒ ๊ฐ๋ค.