72 lines
1.8 KiB
C#
72 lines
1.8 KiB
C#
using DG.Tweening;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 螺丝刀
|
|
/// </summary>
|
|
public class Tool_Screwdriver : Tool_Base
|
|
{
|
|
/// <summary>
|
|
/// 开始安装螺丝
|
|
/// </summary>
|
|
/// <param name="screw"></param>
|
|
public void Install(Tool_Screw screw)
|
|
{
|
|
if (!screw.isInstall)
|
|
{
|
|
screw.BeInstalled(this);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 开始卸载螺丝
|
|
/// </summary>
|
|
/// <param name="screw"></param>
|
|
public void UnInstall(Tool_Screw screw)
|
|
{
|
|
if (screw.isInstall )
|
|
{
|
|
screw.BeUnInstalled(this);
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetMouseButtonDown(0))
|
|
{
|
|
//点击螺丝验电
|
|
Ray tmpray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
if (Physics.Raycast(tmpray, out RaycastHit hit))
|
|
{
|
|
//螺丝
|
|
Tool_Screw ts = hit.transform.GetComponent<Tool_Screw>();
|
|
if (ts != null)
|
|
{
|
|
if(ts.id== "电能表盖子固定螺丝1" && !SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_seal_Left.isCut)
|
|
{
|
|
Debug.Log("封印未剪断");
|
|
return;
|
|
}
|
|
|
|
if (ts.id == "电能表盖子固定螺丝2" && !SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_seal_Right.isCut)
|
|
{
|
|
Debug.Log("封印未剪断");
|
|
return;
|
|
}
|
|
|
|
if (ts.isInstall)
|
|
{
|
|
UnInstall(ts);
|
|
}
|
|
else
|
|
{
|
|
Install(ts);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|