增加高亮功能

This commit is contained in:
2025-04-02 18:28:34 +08:00
parent 8fb3940158
commit 2c46185f49
26 changed files with 1197 additions and 13124 deletions
@@ -11,7 +11,7 @@ namespace AibisDream.FixSystem
{
#region
private BodyModule[] BodyModules { get; set; }
public BodyModule[] BodyModules { get; private set; }
private GameObject _bodyModuleGroup;
private GameObject _headModuleGroup;
@@ -10,6 +10,8 @@ namespace AibisDream.FixSystem
[RequireComponent(typeof(EventTriggerEx))]
public class Plug : MonoBehaviour, IInteraction
{
private static readonly int ShineFade = Shader.PropertyToID("_ShineFade");
#region
private Vector3 _startPos;
@@ -45,6 +47,9 @@ namespace AibisDream.FixSystem
_sprite = GetComponent<SpriteRenderer>();
_plugRootPos = transform.Find("Plug Root Pos");
_trigger = GetComponent<EventTriggerEx>();
// 处理插头高亮
_sprite.material.SetFloat(ShineFade, GlobalVariableKit.IsPlugHighLight ? 1 : 0);
}
private void EventRegister()
@@ -123,6 +128,19 @@ namespace AibisDream.FixSystem
{
// 系统被锁定就返回
if (!_cableSystem.IsPlugAvailable()) return;
// 首次拖拽后关闭高亮
if (GlobalVariableKit.IsPlugHighLight)
{
GlobalVariableKit.IsPlugHighLight = false;
_sprite.material.SetFloat(ShineFade, 0);
// 拖拽后还要高亮其他组件
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
foreach (var module in bodyModuleSystem.BodyModules)
{
module.Highlight(true);
}
}
// 开启拖拽
_isDragging = true;