using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 接线
///
public class Tool_Line: Tool_Base
{
///
/// 是否接上
///
public bool isConnected;
///
/// 标识
///
public string id;
///
/// 固定接线的螺丝
///
public List screws=new List();
protected override void OnAwake()
{
base.OnAwake();
id = gameObject.name;
}
private void OnMouseDown()
{
if(isConnected)
{
//取下接线
if(screws.TrueForAll(a=>!a.isInstall))
{
isConnected = false;
transform.DOLocalMoveY(transform.localPosition.y - 2, 1);
}
}
else
{
//装上接线
if (screws.TrueForAll(a => !a.isInstall))
{
transform.DOLocalMoveY(transform.localPosition.y + 2, 1).OnComplete(() =>
{
isConnected = true;
});
}
}
}
}