헛둘이 2023. 3. 23. 22:45

이번 강의에서는 캐릭터 클래스를 만들고, 만든 캐릭터 클래스를 기반으로 Blueprint 클래스를 생성하는 실습을 했음

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "ShooterCharacter.generated.h"

UCLASS()
class SHOOTER_API AShooterCharacter : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	AShooterCharacter();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

};
// Fill out your copyright notice in the Description page of Project Settings.


#include "ShooterCharacter.h"

// Sets default values
AShooterCharacter::AShooterCharacter()
{
 	// 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;

}

// Called when the game starts or when spawned
void AShooterCharacter::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void AShooterCharacter::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

}

// Called to bind functionality to input
void AShooterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);

}

- 확실히 지금 개인 포트폴리오로 작업 중인 로직과 비슷한 부분이 많은 것 같다

 

- 그리고 이 클래스를 기반으로 한 블루프린트 클래스를 게임 모드에 기본 Pawn으로 등록하는 실습을 진행하였음

- Play를 누르면 이 블루프린트 클래스의 시점으로 변경되고, Eject를 누르니 제 3자의 시점으로 변경돼서 마우스를 통해 움직일 수 있다.

- Eject를 하지 않으면 움직일 수 없는데, 그 이유는 움직이는 스크립트를 작성하지 않았기 때문