Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
PatternWarningDecalActor.h
이 파일의 문서화 페이지로 가기
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CK_UE.h"
7#include "GameFramework/Actor.h"
9#include "PatternWarningDecalActor.generated.h"
10
11class UDecalComponent;
12class UMaterialInterface;
13class USceneComponent;
14class UMaterialInstanceDynamic;
15
16UCLASS()
17class CK_UE_API APatternWarningDecalActor : public AActor, public IObjectPoolingInterface
18{
19 GENERATED_BODY()
20
21public:
23
24 virtual void Tick(float DeltaSeconds) override;
25
27 bool StartCircleWarning(const FTransform& WorldTransform, float StartRadius, float FinalRadius, const FPatternWarningDecalSettings& Settings, USceneComponent* AttachParent = nullptr);
28
30 bool StartLineWarning(const FTransform& WorldTransform, float Length, float Width, const FPatternWarningDecalSettings& Settings, USceneComponent* AttachParent = nullptr);
31
33 bool StartRingWarning(const FTransform& WorldTransform, float InnerRadius, float OuterRadius, const FPatternWarningDecalSettings& Settings, USceneComponent* AttachParent = nullptr);
34
35 void LockCircleWarningAtTransform(const FTransform& WorldTransform);
36
37 // 지정한 시간 동안 채우고 완료 상태를 유지한다. 페이드아웃은 StopWarning에서 시작한다.
38 bool BeginWarningProgress(float Duration);
39 void SetLineLengthRatio(float LengthRatio);
40 void StopWarning();
41 void CancelWarning();
42 void ReturnToPoolImmediately();
43
44protected:
45 virtual void OnSpawnFromPool_Implementation() override;
46 virtual void OnReturnToPool_Implementation() override;
47
48private:
50 bool SetWarningTransform(const FTransform& WorldTransform, const FRotator& ProjectionRotation, USceneComponent* AttachParent);
51
52 // 데칼 준비 함수
53 bool CreateCircleWarningDecals(float StartRadius, float FinalRadius, const FPatternWarningDecalSettings& Settings);
54 bool CreateLineWarningDecals(float Length, float Width, const FPatternWarningDecalSettings& Settings);
55 bool CreateRingWarningDecals(float InnerRadius, float OuterRadius, const FPatternWarningDecalSettings& Settings);
56 bool ConfigureDecalComponent(UDecalComponent* DecalComponent, UMaterialInterface* DecalMaterial, const FVector& DecalSize, int32 SortOrder, float FadeInDuration) const;
57
58 void BeginStopWarning(bool bCompleteProgress);
59 void ApplyFadeOut(UDecalComponent* DecalComponent, float FadeOutDuration) const;
60
61 // 시간 진행은 공통으로 계산하고 도형별 크기만 변경한다.
62 void UpdateWarningProgress();
63 void SetWarningProgress(float Progress);
64
65 void ResetRuntimeState();
66 void ResetDecalComponent(UDecalComponent* DecalComponent) const;
67
68protected:
69 UPROPERTY(VisibleAnywhere, Category = "Warning")
70 TObjectPtr<USceneComponent> SceneRootComponent;
71
72 UPROPERTY(VisibleAnywhere, Category = "Warning")
73 TObjectPtr<UDecalComponent> MaxRangeDecalComponent;
74
75 UPROPERTY(VisibleAnywhere, Category = "Warning")
76 TObjectPtr<UDecalComponent> FillDecalComponent;
77
78private:
79 float WarningStartTime = 0.0f;
80 float CurrentWarningDuration = 0.0f;
81 float CurrentFadeOutDuration = 0.0f;
82 float CurrentLineLength = 0.0f;
83 float CurrentLineLengthRatio = 1.0f;
84 float CurrentProgress = 0.0f;
85 float CurrentCircleStartRadius = 0.0f;
86 float CurrentCircleFinalRadius = 0.0f;
87 bool bIsFadingOut = false;
89 FTimerHandle ReturnToPoolTimerHandle;
90
91 UPROPERTY(Transient)
92 TObjectPtr<UMaterialInstanceDynamic> RingFillMaterial;
93};
static constexpr FGlobalUserSettingsRuntime None
Definition GlobalUserSettingsRuntime.cpp:6
EPatternWarningDecalShape
Definition PatternWarningDecalData.h:11
Definition PatternWarningDecalActor.h:18
Definition ObjectPoolingInterface.h:18
Definition PatternWarningDecalData.h:21