using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting.Antlr3.Runtime;
using UnityEngine;
///
/// 接线盖子
///
public class Device_Cover : Device_Base
{
///
/// 盖子是否已打开
///
public bool isOpen;
///
/// 是否检查接线完好
///
public bool isCheckOK;
private void OnMouseDown()
{
Debug.Log("接线完好");
isCheckOK = true;
if(!isOpen)
{
Device_DirectAccessElectricEnergyMeteringDevice deemd= transform.parent.GetComponent();
if (!deemd.cover_screw_Left.isInstall && !deemd.cover_screw_Right.isInstall)
{
Open();
}
}
else if(isOpen)
{
Close();
}
}
///
/// 打开盖子
///
public void Open()
{
Debug.Log("打开盖子");
isOpen = true;
transform.DOLocalMoveZ(transform.localPosition.z - 0.15f, 2);
}
///
/// 盖上盖子
///
public void Close()
{
Debug.Log("盖上盖子");
isOpen = false;
transform.DOLocalMoveZ(transform.localPosition.z + 0.15f, 2);
}
}