Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
WaveInfoWidget.h
이 파일의 문서화 페이지로 가기
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "UI/UserWidgetBase.h"
7#include "WaveInfoWidget.generated.h"
8
10class UTextBlock;
15UCLASS()
16class CK_UE_API UWaveInfoWidget : public UUserWidgetBase
17{
18 GENERATED_BODY()
19
20protected:
21 virtual void NativeConstruct() override;
22 virtual void NativeDestruct() override;
23
24protected:
25 UFUNCTION(BlueprintImplementableEvent, Category = "UI|WaveInfo")
26 void UpdateEnemyCount(const int32 Count);
27
28 // 다음 웨이브까지 남은 시간(초). 카운트다운 시작 시 1회 + 매 카운트다운 tick 마다 호출.
29 UFUNCTION(BlueprintImplementableEvent, Category = "UI|WaveInfo")
30 void UpdateCountdownTime(const float SecondsRemaining);
31
32private:
33 // 남은 적 수 텍스트 + BP UpdateEnemyCount 이벤트를 함께 갱신.
34 void ApplyRemainingEnemyCount(int32 Count);
35 void UpdateCountdownText();
36
37private:
38 UFUNCTION()
39 void StartCountdown(float Seconds);
40
41 UFUNCTION()
42 void StopCountdown();
43
44 UFUNCTION()
45 void TickCountdown();
46
47 UFUNCTION()
48 void OnEnemyRemainingCountChanged(int32 RemainingCount);
49
50 UFUNCTION()
51 void OnSpawnedEnemyKilled(const AEnemyCharacterBase* DiedEnemy, const int32 RemainingCount);
52
53 UFUNCTION()
54 void OnUpdateWave(const FWaveDataCollection& WaveDataCollection, const int32 CurrentWaveIdx);
55
56protected:
57 UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
58 TObjectPtr<UTextBlock> RemainingEnemyCount;
59
60 UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
61 TObjectPtr<UTextBlock> CurrentWaveIndex;
62
63 UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
64 TObjectPtr<UTextBlock> NextWaveCountdown;
65
66private:
67 // 카운트다운 갱신 주기(초). 표시 정밀도(0.1s)와 맞춰 매끄럽게 갱신.
68 static constexpr float CountdownTickInterval = 0.1f;
69
70 // 다음 웨이브까지 남은 시간(초). 0 이하면 카운트다운 종료.
71 float NextWaveCountdownSeconds = 0.0f;
72
73 // 위젯이 표시하고 있는 남은 몬스터 총합. 이전 웨이브 잔존과 새 웨이브 예정 스폰을 누적해 관리.
74 int32 WidgetRemainingTotal = 0;
75
76 // StageManagementSubsystem이 마지막으로 브로드캐스트한 OnEnemyRemainingCountChanged 값.
77 // 새 웨이브 시작 시점에 새 웨이브의 예정 스폰 수로 사용된다.
78 int32 LastEnemyCountBroadcast = 0;
79
80 // 직전 OnEnemyRemainingCountChanged가 도착하기 직전의 WidgetRemainingTotal.
81 // 새 웨이브 시작 시 이전 웨이브 잔존량(합산의 좌항)으로 사용된다.
82 int32 WidgetTotalBeforeLastBroadcast = 0;
83
84 FTimerHandle CountdownTimerHandle;
85};
Definition EnemyCharacterBase.h:49
Definition UserWidgetBase.h:33
Definition WaveInfoWidget.h:17
Definition StageManifest.h:74