using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 螺丝刀
///
public class Tool_Screwdriver : Tool_Base
{
///
/// 开始安装螺丝
///
///
public void Install(Tool_Screw screw)
{
if (!screw.isInstall)
{
screw.BeInstalled(this);
}
}
///
/// 开始卸载螺丝
///
///
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();
if (ts != null)
{
if(ts.id== "电能表盖子固定螺丝1" && !Device_DirectAccessElectricEnergyMeteringDevice.instance.cover.cover_seal_Left.isCut)
{
Debug.Log("封印未剪断");
return;
}
if (ts.id == "电能表盖子固定螺丝2" && !Device_DirectAccessElectricEnergyMeteringDevice.instance.cover.cover_seal_Right.isCut)
{
Debug.Log("封印未剪断");
return;
}
if (ts.isInstall)
{
UnInstall(ts);
}
else
{
Install(ts);
}
}
}
}
}
}