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()