Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file removed Content/EndlessHotel/Anomaly/Base/BP_Hand.uasset
Binary file not shown.
Binary file not shown.
Binary file added Content/Test/Texture/BP_Dissolve_Main.uasset
Binary file not shown.
Binary file added Content/Test/Texture/MUSIC1.uasset
Binary file not shown.
Binary file added Content/Test/Texture/MUSIC1_basecolor.uasset
Binary file not shown.
Binary file added Content/Test/Texture/M_Dissolve.uasset
Binary file not shown.
Binary file added Content/Test/Texture/M_Dissolve_Inst.uasset
Binary file not shown.
Binary file added Content/Test/Texture/M_Doll_Dissolve.uasset
Binary file not shown.
Binary file added Content/Test/Texture/M_Dot_Main.uasset
Binary file not shown.
Binary file added Content/Test/Texture/NS_Dissolve_main.uasset
Binary file not shown.
Binary file added Content/Test/Texture/tripo_mat_0446a5d8.uasset
Binary file not shown.
Binary file not shown.
Binary file added Content/Vefects/Free_Fire/Demo/Demo.umap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Content/Vefects/Free_Fire/UI/UI.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
147 changes: 147 additions & 0 deletions Source/Endless_Hotel/Anomaly/EightExit/GhostHand/Anomaly_GhostHand.cpp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전반적으로 플레이어 캐릭터나 플레이어 컨트롤러를 들고와서 많이 쓰는데 멤버 변수로 캐싱하여 사용하는 것이 더 효율적으로 보입니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다.

Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// Copyright by 2025-2 WAP Game 2 team


#include "Anomaly/EightExit/GhostHand/Anomaly_GhostHand.h"
#include "Components/StaticMeshComponent.h"
#include "Kismet/GameplayStatics.h"
#include "GameFramework/Character.h"
#include "Components/SkeletalMeshComponent.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "Player/Controller/EHPlayerController.h"
#include "TimerManager.h"

#pragma region Base

AAnomaly_GhostHand::AAnomaly_GhostHand(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
PrimaryActorTick.bCanEverTick = false;

SM_Hand = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("SM_Hand"));
SM_Hand->SetupAttachment(RootComponent);
SM_Hand->SetVisibility(false);
SM_Hand->SetHiddenInGame(true);
SM_Hand->SetCollisionEnabled(ECollisionEnabled::NoCollision);
}

void AAnomaly_GhostHand::BeginPlay()
{
Super::BeginPlay();
}

void AAnomaly_GhostHand::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
ClearRunLock();
Super::EndPlay(EndPlayReason);
}
#pragma endregion

#pragma region Activity
void AAnomaly_GhostHand::ActivateAnomaly(uint8 Anomaly_ID)
{
Super::ActivateAnomaly(Anomaly_ID);
ExecuteGhostHand();
}
#pragma endregion

#pragma region GhostHand
void AAnomaly_GhostHand::ExecuteGhostHand()
{
ACharacter* Player = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);
if (!Player)
{
return;
}

USkeletalMeshComponent* PlayerMesh = Player->GetMesh();
if (!PlayerMesh)
{
return;
}

const FAttachmentTransformRules Rules(EAttachmentRule::SnapToTarget, true);
SM_Hand->AttachToComponent(PlayerMesh, Rules, AttachSocketName);

SM_Hand->SetRelativeLocation(AttachLocationOffset);
SM_Hand->SetRelativeRotation(AttachRotationOffset);
SM_Hand->SetRelativeScale3D(AttachScale);

SM_Hand->SetHiddenInGame(false);
SM_Hand->SetVisibility(true);

if(bLockRun)
{
ApplyRunLock();
}
}
#pragma endregion

#pragma region RunLock
void AAnomaly_GhostHand::ApplyRunLock()
{
ACharacter* Player = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);
if (!Player)
{
return;
}
if (AEHPlayerController* PC = Cast<AEHPlayerController>(UGameplayStatics::GetPlayerController(GetWorld(),0)))
{
if (!bSaved)
{
SavedCanRun = PC->bCanRun;
}
PC->bCanRun = false;
}
UCharacterMovementComponent* Move = Player->GetCharacterMovement();
if (!Move)
{
return;
}
if (!bSaved)
{
SavedMaxWalkSpeed = Move->MaxWalkSpeed;
bSaved = true;
}

Move->MaxWalkSpeed = LockedWalkSpeed;

GetWorld()->GetTimerManager().ClearTimer(ReapplySpeedHandle);
GetWorld()->GetTimerManager().SetTimer(ReapplySpeedHandle, FTimerDelegate::CreateLambda([this]()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateWeakLamda로 변경 바랍니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다.

{
ACharacter* P = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);
Copy link
Collaborator

@KaneBigNose KaneBigNose Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지역변수라도 변수명이 너무 짧으면 의미 전달도 힘들고 충돌 가능성도 높아집니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다.

if (!P)
{
return;
}

if (UCharacterMovementComponent* M = P->GetCharacterMovement())
{
M->MaxWalkSpeed = LockedWalkSpeed;
}
}), ReapplyInterval, true);
}

void AAnomaly_GhostHand::ClearRunLock()
{
if (GetWorld())
{
GetWorld()->GetTimerManager().ClearTimer(ReapplySpeedHandle);
}

if (bSaved)
{
if (ACharacter* Player = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0))
{
if (UCharacterMovementComponent* Move = Player->GetCharacterMovement())
{
Move->MaxWalkSpeed = SavedMaxWalkSpeed;
}
}
bSaved = false;
}
if (AEHPlayerController* PC = Cast<AEHPlayerController>(UGameplayStatics::GetPlayerController(GetWorld(), 0)))
{
PC->bCanRun = SavedCanRun;
}
}
#pragma endregion
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright by 2025-2 WAP Game 2 team

#pragma once

#include "CoreMinimal.h"
#include "Anomaly/Base/Anomaly_Base_EightExit.h"
#include "Anomaly_GhostHand.generated.h"

UCLASS()
class ENDLESS_HOTEL_API AAnomaly_GhostHand : public AAnomaly_Base_EightExit
{
GENERATED_BODY()

#pragma region Base
public:
AAnomaly_GhostHand(const FObjectInitializer& ObjectInitializer);

protected:
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
#pragma endregion

#pragma region Activity
public:
virtual void ActivateAnomaly(uint8 Anomaly_ID) override;
#pragma endregion

#pragma region GhostHand
protected:
UPROPERTY(VisibleAnywhere, Category="GhostHand|Component")
TObjectPtr<class UStaticMeshComponent> SM_Hand;

UPROPERTY(EditAnywhere, Category = "GhostHand|Attach")
FName AttachSocketName = TEXT("Hand_Leg");

UPROPERTY(EditAnywhere, Category = "GhostHand|Attach")
FVector AttachLocationOffset = FVector::ZeroVector;

UPROPERTY(EditAnywhere, Category = "GhostHand|Attach")
FRotator AttachRotationOffset = FRotator::ZeroRotator;

UPROPERTY(EditAnywhere, Category = "GhostHand|Attach")
FVector AttachScale = FVector(1.f, 1.f, 1.f);

UPROPERTY(EditAnywhere, Category = "GhostHand|Time")
float StartDelay = 0.5f;

void ExecuteGhostHand();

FTimerHandle StartDelayHandle;
#pragma endregion

#pragma region RunLock
UPROPERTY(EditAnywhere, Category = "GhostHand|RunLock")
bool bLockRun = true;

UPROPERTY(EditAnywhere, Category = "GhostHand|RunLock")
float LockedWalkSpeed = 300.f;

UPROPERTY(EditAnywhere, Category = "GhostHand|RunLock")
float ReapplyInterval = 0.05f;

FTimerHandle ReapplySpeedHandle;

bool bSaved = false;
float SavedMaxWalkSpeed = 0.f;
bool SavedCanRun = true;

void ApplyRunLock();
void ClearRunLock();
#pragma endregion
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ void AAnomaly_Painting::ActivateAnomaly(uint8 Anomaly_ID)
});
StartImmediate();
break;

case 92:
AnomalyAction = ([](AAnomaly_Object_Base* Portrait)
{
Cast<AAnomaly_Object_Painting>(Portrait)->FrameTilt();
});
ActiveTrigger();
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <Niagara/Public/NiagaraComponent.h>
#include <Components/WidgetComponent.h>
#include <Components/BoxComponent.h>
#include <Components/StaticMeshComponent.h>
#include <Components/SceneComponent.h>
#pragma region Base

AAnomaly_Object_Painting::AAnomaly_Object_Painting(const FObjectInitializer& ObjectInitializer)
Expand Down Expand Up @@ -99,6 +101,111 @@ void AAnomaly_Object_Painting::BlurPaint()

#pragma endregion

#pragma region FrameTilt

void AAnomaly_Object_Painting::FrameTilt()
{
UE_LOG(LogTemp, Warning, TEXT("[FrameTilt] Called"));

if (!GetWorld())
{
return;
}

GetWorld()->GetTimerManager().ClearTimer(FrameTiltDelayHandle);
GetWorld()->GetTimerManager().ClearTimer(FrameTiltInterpHandle);
FrameInitialRotMap.Empty();

TArray<AActor*> AllActors;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), AActor::StaticClass(), AllActors);

for (AActor* FrameActor : AllActors)
{
if (!FrameActor)
{
continue;
}
USceneComponent* TargetRoot = nullptr;
TArray<USceneComponent*> SceneComps;
FrameActor->GetComponents<USceneComponent>(SceneComps);

for (USceneComponent* SC : SceneComps)
{
if (SC && SC->ComponentHasTag(FName("FrameRoot")))
{
TargetRoot = SC;
break;
}
}

if (!TargetRoot)
{
TargetRoot = FrameActor->GetRootComponent();
}

if (!TargetRoot)
{
continue;
}

TargetRoot->SetMobility(EComponentMobility::Movable);

FrameInitialRotMap.Add(FrameActor, FrameActor->GetActorRotation());
}
UE_LOG(LogTemp, Warning, TEXT("[FrameTilt] Targets: %d"), FrameInitialRotMap.Num());
GetWorld()->GetTimerManager().SetTimer(FrameTiltDelayHandle, FTimerDelegate::CreateWeakLambda(this, [this]()
{
if (!GetWorld())
{
return;
}

FrameTiltStartTime = GetWorld()->GetTimeSeconds();
FrameTiltDuration = FMath::FRandRange(FrameTiltInterpMin, FrameTiltInterpMax);
FrameTiltTargetRoll = FMath::FRandRange(FrameTiltRollMin, FrameTiltRollMax);

GetWorld()->GetTimerManager().SetTimer(FrameTiltInterpHandle, FTimerDelegate::CreateWeakLambda(this, [this]()
{
if (!GetWorld())
{
return;
}

const float Now = GetWorld()->GetTimeSeconds();
const float Alpha = FMath::Clamp((Now - FrameTiltStartTime) / FMath::Max(FrameTiltDuration, 0.001f), 0.f, 1.f);
for (auto& Pair : FrameInitialRotMap)
{
AActor* TargetActor = Pair.Key.Get();
if (!TargetActor)
{
continue;
}

const FRotator InitialRot = Pair.Value;
const float NewRoll = FMath::Lerp(InitialRot.Roll, InitialRot.Roll + FrameTiltTargetRoll, Alpha);
FRotator NewRot = InitialRot;
NewRot.Roll = NewRoll;
TargetActor->SetActorRotation(NewRot);
}
if (Alpha >= 1.f)
{
GetWorld()->GetTimerManager().ClearTimer(FrameTiltInterpHandle);
}
}), 0.02f, true);
}), FrameTiltDelay, false);
}
#pragma endregion

void AAnomaly_Object_Painting::Interacted_Implementation()
{
bSolved = !bSolved;
}

void AAnomaly_Object_Painting::ShowInteractWidget_Implementation(bool bIsShow)
{
UI_Interact->ShowDescription(bIsShow);
}
#pragma endregion
#pragma region Interact

void AAnomaly_Object_Painting::Interacted_Implementation()
Expand Down Expand Up @@ -135,4 +242,4 @@ void AAnomaly_Object_Painting::InteractedMoveStep(int32 step)
true, true, 0.2f, false, EMoveComponentAction::Type::Move, LatentInfo);
}

#pragma endregion
#pragma endregion
Loading