diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Cosmetic/InteractableHighlight.cs b/Assets/_DDD/_Scripts/Restaurant/Event/Cosmetic/InteractableHighlight.cs index a31f62ced..172e0487b 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Cosmetic/InteractableHighlight.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Event/Cosmetic/InteractableHighlight.cs @@ -62,10 +62,11 @@ public class InteractableHighlight : MonoBehaviour private float _opacityMultiply = 1.0f; private float _breathingTime; private HighlightEffect _highlightComponent; + private HighlightEffect _highlightProxy; private RestaurantInteractionComponent _interactionComponent; private IInteractor _interactor; private InteractionOutlineType _lastAppliedType = InteractionOutlineType.None; - +` private void Awake() { // OutlineData 딕셔너리 초기화 @@ -76,7 +77,23 @@ private void Awake() _interactionComponent = GetComponent(); // HighlightEffect 설정 적용 - ApplyHighlightSettings(); + ApplyHighlightSettings(_highlightComponent); + } + + private HighlightEffect GetHighlightComponent() + { + return _highlightProxy? _highlightProxy : _highlightComponent; + } + + public void RegisterHighlightProxy(HighlightEffect highlightProxy) + { + _highlightProxy = highlightProxy; + ApplyHighlightSettings(highlightProxy); + } + + public void UnregisterHighlightProxy() + { + _highlightProxy = null; } private void InitializeOutlineData() @@ -91,17 +108,17 @@ private void InitializeOutlineData() }; } - private void ApplyHighlightSettings() + private void ApplyHighlightSettings(HighlightEffect highlightComponent) { - if (!_highlightComponent) return; + if (!highlightComponent) return; - _highlightComponent.alphaCutOff = _alphaCutOff; - _highlightComponent.combineMeshes = _combineMeshes; - _highlightComponent.constantWidth = _constantWidth; - _highlightComponent.outlineQuality = _outlineQuality; - _highlightComponent.outlineIndependent = _outlineIndependent; - _highlightComponent.outlineBlurPasses = _outlineBlurPasses; - _highlightComponent.outlineSharpness = _outlineSharpness; + highlightComponent.alphaCutOff = _alphaCutOff; + highlightComponent.combineMeshes = _combineMeshes; + highlightComponent.constantWidth = _constantWidth; + highlightComponent.outlineQuality = _outlineQuality; + highlightComponent.outlineIndependent = _outlineIndependent; + highlightComponent.outlineBlurPasses = _outlineBlurPasses; + highlightComponent.outlineSharpness = _outlineSharpness; } private void Update() @@ -200,7 +217,8 @@ private void ApplyOutlineType(InteractionOutlineType type) _lastAppliedType = type; - if (!_highlightComponent) + var highlightComponent = GetHighlightComponent(); + if (!highlightComponent) return; // OutlineData에서 해당 타입의 스타일 가져오기 @@ -213,18 +231,18 @@ private void ApplyOutlineType(InteractionOutlineType type) // HighlightEffect에 적용 if (type == InteractionOutlineType.None) { - _highlightComponent.highlighted = false; - _highlightComponent.outline = 0; + highlightComponent.highlighted = false; + highlightComponent.outline = 0; } else { - _highlightComponent.highlighted = true; + highlightComponent.highlighted = true; Color color = data.Color; // color.a = data.Opacity * _opacityMultiply; color *= _opacityMultiply; - _highlightComponent.outlineColor = color; - _highlightComponent.outlineWidth = data.Width; - _highlightComponent.outline = 1; + highlightComponent.outlineColor = color; + highlightComponent.outlineWidth = data.Width; + highlightComponent.outline = 1; } } @@ -257,7 +275,7 @@ private void RefreshOutlineData() [Button("Apply Highlight Settings")] private void ApplyHighlightSettingsButton() { - ApplyHighlightSettings(); + ApplyHighlightSettings(_highlightComponent); } } } \ No newline at end of file