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.
122 lines
2.6 KiB
122 lines
2.6 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using System;
|
|
|
|
namespace DisComputer
|
|
{
|
|
/// <summary>
|
|
/// 指令单元集
|
|
/// </summary>
|
|
public class CommandUnitSet : MonoBehaviour
|
|
{
|
|
|
|
[Header("联合指令集")]
|
|
public List<ComboomItem> comboomItems;
|
|
|
|
[Header("下一个指令单元")]
|
|
public IRegUnit nextUnit;
|
|
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
private void Update()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 启动命令
|
|
/// </summary>
|
|
/// <param name="data"></param>
|
|
public void Command()
|
|
{
|
|
CommandData data = VonNeumann.data;
|
|
RewindRunedCommandArrow();
|
|
ComboomItem item = comboomItems[VonNeumann.CommandIndex];
|
|
item.CommandAct(data,()=>
|
|
{
|
|
nextUnit.Active();
|
|
});
|
|
|
|
}
|
|
|
|
public void Command(Action finish)
|
|
{
|
|
CommandData data = VonNeumann.data;
|
|
RewindRunedCommandArrow();
|
|
ComboomItem item = comboomItems[VonNeumann.CommandIndex];
|
|
item.ClearMask();
|
|
item.CommandAct(data,()=>
|
|
{
|
|
nextUnit.Active();
|
|
finish?.Invoke();
|
|
});
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 启动模糊指令
|
|
/// </summary>
|
|
public void ShakeCommands(Action finish = null)
|
|
{
|
|
StartCoroutine(ProressShakeMask(finish));
|
|
|
|
}
|
|
|
|
IEnumerator ProressShakeMask(Action finish = null)
|
|
{
|
|
for (int i = 0; i < VonNeumann.data.ActCommandList.Count; i++)
|
|
{
|
|
comboomItems[i].MaskShake();
|
|
comboomItems[i].SetCommandVal(VonNeumann.data.ActCommandList[i]);
|
|
yield return new WaitForSeconds(0.2f);
|
|
}
|
|
|
|
finish?.Invoke();
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 重置已使用过箭头
|
|
/// </summary>
|
|
void RewindRunedCommandArrow()
|
|
{
|
|
for (int i = 0; i < comboomItems.Count; i++)
|
|
{
|
|
if (i <= VonNeumann.CommandIndex)
|
|
{
|
|
comboomItems[i].progressArrow.SetArrowZero();
|
|
; }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 复原
|
|
/// </summary>
|
|
public void RewindCommand()
|
|
{
|
|
foreach(var item in comboomItems)
|
|
{
|
|
item.Rewind(0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|