增加高亮功能
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user