From 10a37ca6f6ce83f1979567a0e9648973aa4d06ad Mon Sep 17 00:00:00 2001 From: cd <-> Date: Sun, 28 May 2023 03:49:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2sprite=E6=B6=88=E9=99=A4z-fig?= =?UTF-8?q?hting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/Assets/Game/Scripts/ECS/Component/ViewComponent.cs | 1 + client/Assets/Game/Scripts/ECS/System/ViewSystem.cs | 2 +- client/Assets/Game/Scripts/ECS/Util/UtilComponent.cs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client/Assets/Game/Scripts/ECS/Component/ViewComponent.cs b/client/Assets/Game/Scripts/ECS/Component/ViewComponent.cs index 10a6c36..c5e7722 100644 --- a/client/Assets/Game/Scripts/ECS/Component/ViewComponent.cs +++ b/client/Assets/Game/Scripts/ECS/Component/ViewComponent.cs @@ -29,6 +29,7 @@ public class ViewComponent : IComponent public ShadowPoolItem SkillPointerObject; //技能指示器 // 特殊效果 + public Vector3 LocalPositionOrder = Vector3.zero; //避免z-fighting public Vector3 LocalPositionShake = Vector3.zero; //抖动带来的额外偏移 public Vector3 ScaleDir = Vector3.zero; //缩放方向 public Color FlashColor = Color.white; //闪白颜色 diff --git a/client/Assets/Game/Scripts/ECS/System/ViewSystem.cs b/client/Assets/Game/Scripts/ECS/System/ViewSystem.cs index ac6560b..8bb99f5 100644 --- a/client/Assets/Game/Scripts/ECS/System/ViewSystem.cs +++ b/client/Assets/Game/Scripts/ECS/System/ViewSystem.cs @@ -63,7 +63,7 @@ public class ViewSystem : IExecuteSystem, IInitializeSystem var view = entity.view; view.PositionPre = entity.Pos(); var transView = view.TransformViewMain; - transView.localPosition = view.LocalPositionShake; + transView.localPosition = view.LocalPositionShake + view.LocalPositionOrder; view.PosView.Value = transView.position; } } \ No newline at end of file diff --git a/client/Assets/Game/Scripts/ECS/Util/UtilComponent.cs b/client/Assets/Game/Scripts/ECS/Util/UtilComponent.cs index 5c606ea..d5f0a5e 100644 --- a/client/Assets/Game/Scripts/ECS/Util/UtilComponent.cs +++ b/client/Assets/Game/Scripts/ECS/Util/UtilComponent.cs @@ -80,6 +80,7 @@ public partial class GameEntity view.Material = view.SpriteRenderer.material; view.Collider = go.GetComponent(); + view.LocalPositionOrder = Vector3.forward*GameRandom.Random(0, 0.01f); } public void AddMove()