KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UBasePopup.cpp
이 파일의 문서화 페이지로 가기
1// Copyright (c) 2025 Doppleddiggong. All rights reserved. Unauthorized copying, modification, or distribution of this file, via any medium is strictly prohibited. Proprietary and confidential.
2
3
4#include "UBasePopup.h"
5#include "UGameSoundManager.h"
6
7void UBasePopup::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
8{
9 Super::NativeTick(MyGeometry, InDeltaTime);
10
11 if (bIsOpenAnim)
12 {
13 UpdateAnimation(InDeltaTime);
14 }
15}
16
18{
19 if (!IsInViewport())
20 {
21 AddToViewport();
22 }
23
24 // 팝업 오픈 사운드 재생 (None이 아닐 때만)
26 {
27 if (UGameSoundManager* SoundManager = UGameSoundManager::Get(this))
28 {
29 SoundManager->PlaySound2D(OpenAnimSound);
30 }
31 }
32
33 // 블루프린트에서 정의한 애니메이션이 있으면 해당 애니메이션 재생
35 {
36 PlayAnimation(BlueprintOpenAnimation);
37 return;
38 }
39
40 // 블루프린트 애니메이션이 없으면 기본 스크립트 애니메이션 사용
41 SetRenderTransformPivot(OpenPivot);
42 SetRenderScale(FVector2D(OpenStartScale, OpenStartScale));
43
44 bIsOpenAnim = OpenDuration > KINDA_SMALL_NUMBER;
45 OpenElapsedTime = 0.0f;
46
47 if (!bIsOpenAnim)
48 {
49 SetRenderScale(FVector2D(OpenTargetScale, OpenTargetScale));
50 }
51}
52
53void UBasePopup::UpdateAnimation(float InDeltaTime)
54{
55 if (!bIsOpenAnim)
56 {
57 return;
58 }
59
60 OpenElapsedTime += InDeltaTime;
61
62 const float Alpha = FMath::Clamp(OpenElapsedTime / OpenDuration, 0.0f, 1.0f);
63 const float EasedAlpha = FEaseHelper::Ease(Alpha, OpenEaseType);
64 const float NewScale = FMath::Lerp(OpenStartScale, OpenTargetScale, EasedAlpha);
65
66 SetRenderScale(FVector2D(NewScale, NewScale));
67
68 if (Alpha >= 1.0f)
69 {
70 bIsOpenAnim = false;
71 }
72}
UGameSoundManager 클래스를 선언합니다.
EGameSoundType OpenAnimSound
팝업 오픈 시 재생될 사운드 타입
Definition UBasePopup.h:96
void OpenAnimation()
팝업 오픈 애니메이션을 재생합니다
float OpenDuration
애니메이션 지속 시간
Definition UBasePopup.h:64
float OpenElapsedTime
경과 시간
Definition UBasePopup.h:60
virtual void NativeTick(const FGeometry &MyGeometry, float InDeltaTime) override
Definition UBasePopup.cpp:7
bool bIsOpenAnim
애니메이션 재생 중 여부
Definition UBasePopup.h:57
void UpdateAnimation(float InDeltaTime)
스크립트 오픈 애니메이션 업데이트
float OpenStartScale
시작 스케일
Definition UBasePopup.h:68
FVector2D OpenPivot
애니메이션 중심점 (0~1 범위)
Definition UBasePopup.h:76
EEaseType OpenEaseType
Easing 타입
Definition UBasePopup.h:83
float OpenTargetScale
목표 스케일
Definition UBasePopup.h:72
UWidgetAnimation * BlueprintOpenAnimation
블루프린트에서 정의한 오픈 애니메이션
Definition UBasePopup.h:45
게임 내 모든 사운드 재생을 관리하는 중앙 사운드 관리 서브시스템입니다.
static float Ease(float Alpha, EEaseType Type)
Definition FEaseHelper.h:45