UE-Blueprint C++로 옮기기

Ryan Ham·2024년 6월 7일
1

Unreal Engine

목록 보기
6/27
// MyFountain.h

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyFountain.generated.h"

UCLASS()
class ARENABATTLE_API AMyFountain : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AMyFountain();

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

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

	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Mesh)
	// 전방선언 하기!
	TObjectPtr<class UStaticMeshComponent> Body;

	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Mesh)
	TObjectPtr<class UStaticMeshComponent> Water;

};

// MyFountain.cpp


#include "Props/MyFountain.h"
#include "Components/StaticMeshComponent.h"

// Sets default values
AMyFountain::AMyFountain()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	Body = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Body"));
	Water = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Water"));

	RootComponent = Body;
	Water->SetupAttachment(Body);
	Water->SetRelativeLocation(FVector(0.f, 0.f, 140.f));

	static ConstructorHelpers::FObjectFinder<UStaticMesh> BodyMeshRef(TEXT("/Game/ArenaBattle/Environment/Props/SM_Plains_Castle_Fountain_01.SM_Plains_Castle_Fountain_01"));
	if (BodyMeshRef.Object) {
		Body->SetStaticMesh(BodyMeshRef.Object);
	}

	static ConstructorHelpers::FObjectFinder<UStaticMesh> WaterMeshRef(TEXT("/Game/ArenaBattle/Environment/Props/SM_Plains_Fountain_02.SM_Plains_Fountain_02"));
	if (WaterMeshRef.Object) {
		Water->SetStaticMesh(WaterMeshRef.Object);
	}

}

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

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

}

profile
🏦KAIST EE | 🏦SNU AI(빅데이터 핀테크 전문가 과정) | 📙CryptoHipsters 저자

0개의 댓글