using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 验电笔
///
public class Tool_TestPen : Tool_Base
{
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
//点击螺丝验电
Ray tmpray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(tmpray, out RaycastHit hit))
{
//插座
Device_Base db = hit.transform.GetComponent();
if (db != null)
{
Test(db);
return;
}
//柜门
Tool_Base tb= hit.transform.GetComponent();
if(tb != null)
{
Test(tb);
return;
}
}
}
}
///
/// 执行验电操作
///
/// 被验电设备
public void Test(Device_Base device_base)
{
if (device_base.deviceType == DeviceType.计量柜_插座)
{
var tmp = ((Device_Socket)device_base);
//位置移动
transform.position = tmp.testPosAndRot.position;
transform.eulerAngles = tmp.testPosAndRot.eulerAngles;
Debug.Log("计量柜_插座 已验电");
}
else if(device_base.deviceType == DeviceType.计量柜_柜门)
{
var tmp = ((Device_CabinetDoor)device_base);
//位置移动
transform.position = tmp.testPosAndRot.position;
transform.eulerAngles = tmp.testPosAndRot.eulerAngles;
Debug.Log("计量柜_柜门 已验电");
}
}
///
/// 执行验电操作
///
/// 被验电设备
public void Test(Tool_Base tool_base)
{
if (tool_base.toolType == ToolType.螺丝)
{
var tmp = ((Tool_Screw)tool_base);
//位置移动
transform.position = tmp.installPos.position;
transform.eulerAngles = tmp.installPos.eulerAngles;
Debug.Log("螺丝 已验电");
}
}
}