꾸준히 하다보니까 이전에 하던 것들과 겹치는 것들도 생겨서 고통은 받았지만 전보단 덜했다.
void ASpiralActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
// raidus * cos x, sin y
if (!ListRotationFootrest.empty())
{
FVector Local = GetActorLocation();
auto iter = ListRotationFootrest.begin();
auto iter_end = ListRotationFootrest.end();
size_t Size = ListRotationFootrest.size();
FloorCount = 0;
for (uint32 i=0;iter != iter_end;++i)
{
if (iter->IsValid())
{
ARotationFootrest* SpawnedActor = iter->Get();
SpawnedActor->AddAngle(SpiralSpeed * DeltaTime);
float AngleDegrees = SpawnedActor->GetAngle();
float AngleRadians = FMath::DegreesToRadians(AngleDegrees);
float RotX = Local.X + FMath::Cos(AngleRadians) * Radius;
float RotY = Local.Y + FMath::Sin(AngleRadians) * Radius;
float RotZ = SpawnedActor->GetActorLocation().Z + (RisingSpeed * DeltaTime);
FVector Location = {RotX, RotY, RotZ};
SpawnedActor->SetActorLocation(Location);
if (SpawnedActor->GetActorLocation().Z - Local.Z <= Floor)
{
++FloorCount;
}
if (RotZ - Local.Z >= HeightMax)
{
SpawnedActor->Destroy();
}
++iter;
}
else
{
iter = ListRotationFootrest.erase(iter);
}
}
//UE_LOG(LogTemp, Display, TEXT("Floor Count: %d"), FloorCount);
if (ListRotationFootrest.back()->GetActorLocation().Z - Local.Z > HeightIncrease && FloorCount < 1)
{
auto Footrest = CreateRotationFootrest();
Footrest->AddAngle(ListRotationFootrest.back()->GetAngle() + DefaultAngle);
FVector NewLocal = FVector::ZeroVector;
NewLocal.Z = Local.Z;
Footrest->SetActorLocation(NewLocal);
ListRotationFootrest.emplace_back(Footrest);
}
}
}
언리얼에서는 interface를 제공한다
interface는 특정 기능을 확장하기 위한 컴포넌트와는 다른 개념이고 다중상속을 이용해
특정기능만을 추가하고싶은 경우 사용하게 된다.
특정 레벨에서 동작해야하는 이벤트가 있을 경우 사용한다.
instance에서 관리하면 좋다고 한다.
미로 생성 강의를 봤다 만들까 싶었는데 그럼 레벨 문제가 생겨서 일단 기록만 해둔다.