From bda06886603b67dd00bc12f892659611806241f8 Mon Sep 17 00:00:00 2001 From: Nam Tae Gun Date: Fri, 28 Jun 2024 14:09:12 +0900 Subject: [PATCH] =?UTF-8?q?=ED=94=8C=EB=A0=88=EC=9D=B4=EC=96=B4=20?= =?UTF-8?q?=EB=8C=80=EC=89=AC=20=EC=A4=91=20=EC=BA=90=EB=A6=AD=ED=84=B0=20?= =?UTF-8?q?=ED=9D=94=EB=93=A4=EB=A6=BC=20=ED=9A=A8=EA=B3=BC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Character/Player/Combat/CombatMovement.cs | 52 ++++---- .../Characters/Players/CombatPlayer.prefab | 112 +++++++++++++++++- 2 files changed, 131 insertions(+), 33 deletions(-) diff --git a/Assets/02.Scripts/Character/Player/Combat/CombatMovement.cs b/Assets/02.Scripts/Character/Player/Combat/CombatMovement.cs index bddea67b1..954709c1e 100644 --- a/Assets/02.Scripts/Character/Player/Combat/CombatMovement.cs +++ b/Assets/02.Scripts/Character/Player/Combat/CombatMovement.cs @@ -1,7 +1,9 @@ +using System; using System.Collections; using BlueWater.Audios; using BlueWater.Interfaces; using BlueWater.Utility; +using DG.Tweening; using Sirenix.OdinInspector; using UnityEngine; @@ -95,12 +97,9 @@ namespace BlueWater.Players.Combat [field: SerializeField, Tooltip("대쉬가 쿨타임일 때 이펙트 사용 여부")] public bool EnableDashCooldownEffect { get; private set; } = true; - - [field: SerializeField, Range(0f, 1f), Tooltip("대쉬가 쿨타임일 때, VisualLook이 x축 좌우로 움직이는 범위")] - public float DashCooldownShakingOffset { get; private set; } = 0.1f; - - [field: SerializeField, Range(0, 10f), Tooltip("대쉬가 쿨타임일 때, VisualLook이 x축 좌우로 움직이는 횟수")] - public int DashCooldownShakingCount { get; private set; } = 2; + + [SerializeField] + private DOTweenAnimation _dashCooldownEffect; public bool IsDashEnabled { get; private set; } = true; @@ -118,7 +117,7 @@ namespace BlueWater.Players.Combat public bool IsDashCoolDownActive { get; private set; } private Coroutine _dashCoroutine; - private Coroutine _dashCooldownEffectCoroutineInstance; + private bool _isQuitting; #endregion @@ -141,7 +140,19 @@ namespace BlueWater.Players.Combat Move(); } - + + private void OnApplicationQuit() + { + _isQuitting = true; + } + + private void OnDestroy() + { + if (_isQuitting) return; + + _dashCooldownEffect.DOKill(); + } + #endregion // Initialize Methods @@ -157,6 +168,7 @@ namespace BlueWater.Players.Combat _comboAttackable = GetComponent(); _skillHandler = GetComponent(); _stunnable = GetComponent(); + _dashCooldownEffect = _visualLook.GetComponent(); } #endregion @@ -227,18 +239,11 @@ namespace BlueWater.Players.Combat { if (EnableDashCooldownEffect) { - Utils.StartUniqueCoroutine(this, ref _dashCooldownEffectCoroutineInstance, DashCoolDownEffectCoroutine()); + _dashCooldownEffect.DORestart(); } return false; } - if (EnableDashCooldownEffect && _dashCooldownEffectCoroutineInstance != null) - { - StopCoroutine(_dashCooldownEffectCoroutineInstance); - _dashCooldownEffectCoroutineInstance = null; - _visualLook.localPosition = Vector3.zero; - } - var isActivatingSkill = _skillHandler?.IsActivatingSkill ?? false; var isStunned = _stunnable?.IsStunned ?? false; @@ -252,21 +257,6 @@ namespace BlueWater.Players.Combat return true; } - - private IEnumerator DashCoolDownEffectCoroutine() - { - var newLocalPosition = _visualLook.localPosition; - for (var i = 0; i < DashCooldownShakingCount; i++) - { - newLocalPosition.x = DashCooldownShakingOffset; - _visualLook.localPosition = newLocalPosition; - yield return null; - - newLocalPosition.x = -DashCooldownShakingOffset; - _visualLook.localPosition = newLocalPosition; - yield return null; - } - } public void Dash() { diff --git a/Assets/05.Prefabs/Characters/Players/CombatPlayer.prefab b/Assets/05.Prefabs/Characters/Players/CombatPlayer.prefab index 6c3d6e1fe..e0dfec617 100644 --- a/Assets/05.Prefabs/Characters/Players/CombatPlayer.prefab +++ b/Assets/05.Prefabs/Characters/Players/CombatPlayer.prefab @@ -515,8 +515,7 @@ MonoBehaviour: k__BackingField: 0.2 k__BackingField: 0.5 k__BackingField: 1 - k__BackingField: 0.1 - k__BackingField: 2 + _dashCooldownEffect: {fileID: 0} --- !u!114 &3889238742570113982 MonoBehaviour: m_ObjectHideFlags: 0 @@ -688,6 +687,7 @@ GameObject: - component: {fileID: 2668222795840865044} - component: {fileID: 5558898291459354456} - component: {fileID: 3031446967001791208} + - component: {fileID: 8975283155893490419} m_Layer: 9 m_Name: VisualLook m_TagString: Untagged @@ -787,6 +787,114 @@ Animator: m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorStateOnDisable: 0 m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &8975283155893490419 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8540731795983184644} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4d0390bd8b8ffd640b34fe25065ff1df, type: 3} + m_Name: + m_EditorClassIdentifier: + updateType: 0 + isSpeedBased: 0 + hasOnStart: 0 + hasOnPlay: 0 + hasOnUpdate: 0 + hasOnStepComplete: 0 + hasOnComplete: 0 + hasOnTweenCreated: 0 + hasOnRewind: 0 + onStart: + m_PersistentCalls: + m_Calls: [] + onPlay: + m_PersistentCalls: + m_Calls: [] + onUpdate: + m_PersistentCalls: + m_Calls: [] + onStepComplete: + m_PersistentCalls: + m_Calls: [] + onComplete: + m_PersistentCalls: + m_Calls: [] + onTweenCreated: + m_PersistentCalls: + m_Calls: [] + onRewind: + m_PersistentCalls: + m_Calls: [] + targetIsSelf: 1 + targetGO: {fileID: 0} + tweenTargetIsTargetGO: 1 + delay: 0 + duration: 0.3 + easeType: 1 + easeCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + loopType: 0 + loops: 1 + id: + isRelative: 0 + isFrom: 0 + isIndependentUpdate: 0 + autoKill: 0 + autoGenerate: 1 + isActive: 1 + isValid: 1 + target: {fileID: 2668222795840865044} + animationType: 9 + targetType: 11 + forcedTargetType: 0 + autoPlay: 0 + useTargetAsV3: 0 + endValueFloat: 0 + endValueV3: {x: 0.2, y: 0, z: 0} + endValueV2: {x: 0, y: 0} + endValueColor: {r: 1, g: 1, b: 1, a: 1} + endValueString: + endValueRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 0 + height: 0 + endValueTransform: {fileID: 0} + optionalBool0: 0 + optionalBool1: 0 + optionalFloat0: 1 + optionalInt0: 30 + optionalRotationMode: 0 + optionalScrambleMode: 0 + optionalShakeRandomnessMode: 0 + optionalString: --- !u!1001 &863562677678979986 PrefabInstance: m_ObjectHideFlags: 0