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.

128 lines
2.9 KiB

using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace DisComputer
{
public class IIIPRegUnit : BasicUnit
{
//累加提示
public GameObject sumTipGo;
//指令集
public IIICommandUnitSet commandUnitSet;
public GameObject addNumGo;
public override void Start()
{
base.Start();
}
public void Active(Action finish = null, params object[] data)
{
int id = (int)data[0];
if (id >= progressArrows.Count)
{
Debug.Log("箭头指向下标超出");
id = progressArrows.Count - 1;
}
base.Active(data);
RewindRunedArrow();
ShowArrow(id, false, () =>
{
commandUnitSet.comboomItems[id].AddressAct();
finish?.Invoke();
});
ShowAddEff();
}
public override void Active(params object[] data)
{
int id = (int)data[0];
if (id >= progressArrows.Count)
{
Debug.Log("箭头指向下标超出");
id = progressArrows.Count - 1;
}
base.Active(data);
RewindRunedArrow();
ShowArrow(id, false, () =>
{
commandUnitSet.comboomItems[id + 1].AddressAct();
Action call = (Action)data[1];
call?.Invoke();
});
ShowAddEff();
}
/// <summary>
/// 重置已使用箭头
/// </summary>
public void RewindRunedArrow()
{
for (int i = 0; i < progressArrows.Count; i++)
{
progressArrows[i].SetArrowZero();
}
sumTipGo.SetActive(false);
}
public override void RewindUnit()
{
base.RewindUnit();
if (progressArrows != null && progressArrows.Count > 0)
{
foreach (var item in progressArrows)
{
if (item.isInitHide)
item.SetArrowZero();
}
}
sumTipGo.SetActive(false);
}
/// <summary>
/// 显示加分动效
/// </summary>
void ShowAddEff()
{
GameObject addGo = Instantiate(addNumGo, this.transform);
addGo.transform.localScale = Vector3.zero;
addGo.transform.DOScale(new Vector3(1, 1, 1), 0.5f);
addGo.SetActive(true);
Sequence sequence = DOTween.Sequence();
sequence.Append(addGo.transform.DOLocalMoveY(35, 0.5f))
.Append(addGo.transform.DOScale(Vector3.zero, 0.35f).SetDelay(0.5f))
.OnComplete(() =>
{
Destroy(addGo);
});
}
}
}