54 lines
987 B
C#
54 lines
987 B
C#
using DG.Tweening;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 柜门
|
|
/// </summary>
|
|
public class Device_CabinetDoor : Device_Base
|
|
{
|
|
/// <summary>
|
|
/// 验电位置
|
|
/// </summary>
|
|
public Transform testPosAndRot;
|
|
/// <summary>
|
|
/// 封印
|
|
/// </summary>
|
|
public Device_Seal seal;
|
|
|
|
public bool isOpen;
|
|
|
|
public void Open()
|
|
{
|
|
Debug.Log("开门");
|
|
transform.DOLocalRotate(new Vector3(0,0,180), 3).OnComplete(() =>
|
|
{
|
|
isOpen = true;
|
|
});
|
|
}
|
|
public void Close()
|
|
{
|
|
Debug.Log("关门");
|
|
transform.DOLocalRotate(new Vector3(0,0,0), 3).OnComplete(() =>
|
|
{
|
|
isOpen = false;
|
|
});
|
|
}
|
|
|
|
private void OnMouseDown()
|
|
{
|
|
if(seal.isCut)
|
|
{
|
|
if(isOpen)
|
|
{
|
|
Close();
|
|
}
|
|
else
|
|
{
|
|
Open();
|
|
}
|
|
}
|
|
}
|
|
}
|