From b781f9ecf36bcc6c614538ac427fa2eb8f1e29d2 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 29 Sep 2021 20:26:12 +0800 Subject: *misc --- Assets/Scripts/Unit/Components/UnitLensEffect.cs | 14 ++++++++++++++ Assets/Scripts/Unit/Components/UnitState/PCState.cs | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'Assets/Scripts/Unit/Components') diff --git a/Assets/Scripts/Unit/Components/UnitLensEffect.cs b/Assets/Scripts/Unit/Components/UnitLensEffect.cs index 7758c943..a3c5d2c8 100644 --- a/Assets/Scripts/Unit/Components/UnitLensEffect.cs +++ b/Assets/Scripts/Unit/Components/UnitLensEffect.cs @@ -140,6 +140,8 @@ public class UnitLensEffect : UnitComponent } } + List temp = ListPool.Get(); + for (int i = 0; i < m_Effects.Count; ++i) { LensEffectBase eff = m_Effects[i]; @@ -147,8 +149,20 @@ public class UnitLensEffect : UnitComponent if (method == null) continue; method.Invoke(eff, new object[] { }); + if(eff.CanDestroy()) + { + temp.Add(eff); + } } + for(int i = 0; i< temp.Count; ++i) + { + temp[i].OnDestroy(); + m_Effects.Remove(temp[i]); + } + + ListPool.Release(temp); + foreach (var cb in m_InUseCommandBuffers) { CameraEvent ce = cb.Key.ToCameraEvent(); diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState.cs b/Assets/Scripts/Unit/Components/UnitState/PCState.cs index e545dea0..1bdd355f 100644 --- a/Assets/Scripts/Unit/Components/UnitState/PCState.cs +++ b/Assets/Scripts/Unit/Components/UnitState/PCState.cs @@ -144,7 +144,7 @@ public partial class PCState : UnitState UnitSnapshotInfo info = owner.TakeSnapshot(); Vector2 dir = TestErika.Instance.monster.owner.center + new Vector3(offset, -0.5f, 0) - owner.center; - LensEffect_Dash dash = new LensEffect_Dash(Color.white, 2, Mathf.Atan2(dir.y, dir.x), info); + LensEffect_Dash dash = new LensEffect_Dash(Color.white, 0.1f, Mathf.Atan2(dir.y, dir.x), info); owner.unitLensEffect.AddEffect(dash); owner.center = TestErika.Instance.monster.owner.center + new Vector3(offset, -0.5f, 0); -- cgit v1.1-26-g67d0