게임프로그래밍/TheZombie
게임 개발 - Player 데이터 분할
설련
2022. 2. 4. 17:33
요즘 몸이 말이 아니다.
저번 주 금요일에 대학교를 졸업하였는데, 하나의 고개를 넘은 기분이 들어서 그런지는 모르겠지만 정신적으로 조금 너덜너덜한 상태이다.
분명 좋은 일임은 틀림 없으나 앞으로의 고개가 더욱 가파르기 때문일 것이다.
맑은 정신에 건강한 육체가 깃든다고, 요새 전체적인 강행군으로 인해 정신도 육체도 말이 아닌 것이다.
하지만 그렇다고 미래로 정진하는 것을 포기할 수는 없는 법. 어제는 계속 쓰러져 있었지만, 오늘은 그래도 정신을 잃을 정도는 아니라서 작게나마 진도를 나갔다.
우선 이 게임의 전체 틀을 '하나의 레벨' 안에서 처리할 예정이기 때문에 Status 전용의 Component를 만들었다.
만약 여러 레벨에서 통용할 Status를 만들거라면 게임인스턴스와 같은 데이터 저장 장소가 필요할 것이다.
#include "CoreMinimal.h"
#include "EnumClass.h"
#include "Components/ActorComponent.h"
#include "PlayerStatus.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class THEZOMBIES_API UPlayerStatus : public UActorComponent
{
GENERATED_BODY()
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Weapon, meta = (AllowPrivateAccess = "true"))
class AWeapon* CurWeapon;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Weapon, meta = (AllowPrivateAccess = "true"))
class AGun* MainWeapon;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Weapon, meta = (AllowPrivateAccess = "true"))
class AGun* SubWeapon;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Weapon, meta = (AllowPrivateAccess = "true"))
class AWeapon* Knife;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Weapon, meta = (AllowPrivateAccess = "true"))
class AGrenade* Grenade;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Health, meta = (AllowPrivateAccess = "true"))
float HP;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Health, meta = (AllowPrivateAccess = "true"))
float SP;
public:
// Sets default values for this component's properties
UPlayerStatus();
protected:
// Called when the game starts
virtual void BeginPlay() override;
virtual void InitializeComponent() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
void setCurrentWeapon(EStateCharacter state);
};
아무것도 없이 내 스스로 생각해서 개발해야 한다고 생각하니 눈앞이 캄캄하기만 한 것도 있는 것 같다.