79 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			79 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using UnityEngine;
 | |
| 
 | |
| /// <summary>
 | |
| /// 检查接线完好
 | |
| /// </summary>
 | |
| public class Check_JieXian : PermanentTriggerBase
 | |
| {
 | |
|     /// <summary>
 | |
|     /// 是否已检查接线完好
 | |
|     /// </summary>
 | |
|     public bool isChecked;
 | |
|     /// <summary>
 | |
|     /// 接线
 | |
|     /// </summary>
 | |
|     public List<Tool_Line> tool_Lines;
 | |
|     /// <summary>
 | |
|     /// 接线螺丝
 | |
|     /// </summary>
 | |
|     public List<Tool_Screw> tool_Screws;
 | |
| 
 | |
|     protected override void OnStart()
 | |
|     {
 | |
|         base.OnStart();
 | |
|         tool_Screws.ForEach(screw => 
 | |
|         {
 | |
|             screw.AddCheckAction(() => 
 | |
|             {
 | |
|                 //接线螺丝要先点击检查接线
 | |
|                 return isChecked;
 | |
|             });
 | |
|         });
 | |
|     }
 | |
|     protected override void OnMEnter()
 | |
|     {
 | |
|         base.OnMEnter();
 | |
|         _highlight.SetHighlighted(true);
 | |
|     }
 | |
|     protected override void OnMDown()
 | |
|     {
 | |
|         base.OnMDown();
 | |
|         if (tool_Lines.TrueForAll(a => a.isConnected) && tool_Screws.TrueForAll(a => a.isInstall))
 | |
|         {
 | |
|             Invoke("Check", 1);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     protected override void OnMExit()
 | |
|     {
 | |
|         base.OnMExit();
 | |
|         _highlight.SetHighlighted(false);
 | |
|     }
 | |
|     /// <summary>
 | |
|     /// 检查成功
 | |
|     /// </summary>
 | |
|     public void Check()
 | |
|     {
 | |
|         if (GameManager.ProcessMgr?.IsRightSubProcessStepsTriggerID(triggerName, true) == 0)
 | |
|         {
 | |
| 
 | |
|             Debug.Log("接线完好");
 | |
|             isChecked = true;
 | |
|             GetComponent<BoxCollider>().enabled = false;
 | |
| 
 | |
|             if (GameManager.UIMgr != null)
 | |
|             {
 | |
|                 GameObject tip2 = Instantiate<GameObject>(Resources.Load<GameObject>("UI/UI_Tip/TipPanel"), GameManager.UIMgr.canvas.transform);
 | |
|                 TipPanel tipPanel = tip2.GetComponent<TipPanel>();
 | |
|                 tipPanel.Init("接线完好!");
 | |
|             }
 | |
| 
 | |
|             //GameManager.ProcessMgr?.IsRightSubProcessStepsTriggerID(triggerName, true);
 | |
| 
 | |
|             base.CallScoreAction(true);
 | |
|         }
 | |
|     }
 | |
| }
 |