You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
2.4 KiB
112 lines
2.4 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using System;
|
|
|
|
|
|
namespace DisComputer
|
|
{
|
|
/// <summary>
|
|
/// 双向寄存器
|
|
/// </summary>
|
|
public class TwoWayUnit : BasicUnit
|
|
{
|
|
|
|
public override void Start()
|
|
{
|
|
base.Start();
|
|
}
|
|
|
|
|
|
public override void Active(params object[] data)
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 主动接受激活
|
|
/// </summary>
|
|
/// <param name="val"></param>
|
|
public void ReceiveActive(string val,Action finish=null)
|
|
{
|
|
ShakeUnit();
|
|
|
|
if(!string.IsNullOrEmpty(val))
|
|
SetInfoTxt(val);
|
|
|
|
finish?.Invoke();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 箭头指向执行激活
|
|
/// </summary>
|
|
/// <param name="dirId"></param>
|
|
/// <param name="val"></param>
|
|
/// <param name="finish"></param>
|
|
public void ArrowActive(int dirId,string val,Action finish=null)
|
|
{
|
|
|
|
if(dirId == 0)
|
|
progressArrows[1].SetArrowZero();
|
|
else
|
|
progressArrows[0].SetArrowZero();
|
|
|
|
ShowArrow(dirId, true,() =>
|
|
{
|
|
if(!string.IsNullOrEmpty(val))
|
|
SetInfoTxt(val);
|
|
|
|
ShakeUnit();
|
|
finish?.Invoke();
|
|
});
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 自身发射箭头执行
|
|
/// </summary>
|
|
/// <param name="dirId"></param>
|
|
/// <param name="val"></param>
|
|
/// <param name="finish"></param>
|
|
public void SelfActiveArrow(int dirId, string val, Action finish = null)
|
|
{
|
|
if (dirId == 0)
|
|
progressArrows[1].SetArrowZero();
|
|
else
|
|
progressArrows[0].SetArrowZero();
|
|
|
|
if (!string.IsNullOrEmpty(val))
|
|
SetInfoTxt(val);
|
|
ShakeUnit();
|
|
|
|
ShowArrow(dirId, true, () =>
|
|
{
|
|
finish?.Invoke();
|
|
});
|
|
}
|
|
|
|
|
|
public override void RewindUnit()
|
|
{
|
|
base.RewindUnit();
|
|
if (progressArrows != null && progressArrows.Count > 0)
|
|
{
|
|
foreach (var item in progressArrows)
|
|
{
|
|
item.SetArrowZero();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|