using Core.Utilities;
|
using DG.Tweening;
|
using System.Collections.Generic;
|
using TowerDefense.Level;
|
using UnityEngine;
|
|
public class EndlessWaveLineManager : Singleton<EndlessWaveLineManager>
|
{
|
/// <summary>
|
/// 兵线对应的选中效果
|
/// </summary>
|
public List<GameObject> waveLineList;
|
|
/// <summary>
|
/// 标注战场区域的Object.
|
/// </summary>
|
public GameObject battleAreaObject;
|
|
/// <summary>
|
/// 火攻击效果
|
/// </summary>
|
public ParticleSystem skillFirePrefab;
|
|
/// <summary>
|
/// 炸弹攻击效果
|
/// </summary>
|
public ParticleSystem skillBombPrefab;
|
|
/// <summary>
|
/// 停止移动的Buff特效.
|
/// </summary>
|
public ParticleSystem bufStopMovePrefab;
|
|
protected bool zeroState = true;
|
|
// Start is called before the first frame update
|
void Start()
|
{
|
for (int ti = 0; ti < waveLineList.Count; ti++)
|
{
|
if (waveLineList[ti])
|
{
|
Material tmat = waveLineList[ti].GetComponent<MeshRenderer>().material;
|
tmat.color = new Color(1.0f, 1.0f, 1.0f, 0.0f);
|
}
|
}
|
}
|
|
/// <summary>
|
/// 在某一兵线上播放技能特效
|
/// </summary>
|
public void PlayWaveLineEffect(int id)
|
{
|
if (id >= waveLineList.Count || waveLineList[id] == null) return;
|
|
ParticleSystem playParticle = Instantiate(skillFirePrefab);
|
playParticle.transform.position = EndlessLevelManager.instance.WaveManager.GetWaveEndPos(id);
|
playParticle.Play();
|
Destroy(playParticle.gameObject, playParticle.main.duration);
|
}
|
|
/// <summary>
|
/// 在战场内某一个位置播放特效
|
/// </summary>
|
/// <param name="pos"></param>
|
public void PlayBattleAreaBombEffect(Vector3 pos)
|
{
|
if (skillBombPrefab == null) return;
|
ParticleSystem playParticle = Instantiate(skillBombPrefab);
|
playParticle.transform.position = pos;
|
playParticle.Play();
|
Destroy(playParticle.gameObject, playParticle.main.duration);
|
}
|
|
/// <summary>
|
/// 对应兵线发亮.
|
/// </summary>
|
/// <param name="id"></param>
|
public void WaveLineFlash(int id)
|
{
|
if (id >= waveLineList.Count || waveLineList[id] == null) return;
|
|
//设置一个DOTween队列
|
Sequence flashSeq = DOTween.Sequence();
|
Material tmat = waveLineList[id].GetComponent<MeshRenderer>().material;
|
flashSeq.Append(tmat.DOColor(new Color(1.0f, 1.0f, 1.0f, 1.0f), 0.1f));
|
flashSeq.Append(tmat.DOColor(new Color(1.0f, 1.0f, 1.0f, 0.2f), 0.08f));
|
flashSeq.Append(tmat.DOColor(new Color(1.0f, 1.0f, 1.0f, 1.0f), 0.08f));
|
flashSeq.AppendInterval(0.05f);
|
flashSeq.Append(tmat.DOColor(new Color(1.0f, 1.0f, 1.0f, 0.2f), 0.08f));
|
flashSeq.Append(tmat.DOColor(new Color(1.0f, 1.0f, 1.0f, 1.0f), 0.08f));
|
flashSeq.AppendInterval(0.05f);
|
flashSeq.Append(tmat.DOColor(new Color(1.0f, 1.0f, 1.0f, 0.0f), 0.25f));
|
}
|
|
/// <summary>
|
/// 对某一条兵线显示选中效果
|
/// </summary>
|
/// <param name="id"></param>
|
public void FadeWaveline(int id, bool fadeOut, float ftime = 0.3f)
|
{
|
if (id >= waveLineList.Count || waveLineList[id] == null) return;
|
Material tmat = waveLineList[id].GetComponent<MeshRenderer>().material;
|
if (fadeOut)
|
tmat.DOColor(new Color(1.0f, 1.0f, 1.0f, 1.0f), ftime);
|
else
|
tmat.DOColor(new Color(1.0f, 1.0f, 1.0f, 0.0f), ftime);
|
}
|
|
/// <summary>
|
/// 某一个位置攻击塔位放下。
|
/// </summary>
|
/// <param name="pos"></param>
|
public void AttackTowerFixed(int pos)
|
{
|
if (pos >= waveLineList.Count || waveLineList[pos] == null) return;
|
|
int subone = pos - 1;
|
int addone = pos + 1;
|
|
if (subone >= 0)
|
WaveLineFlash(subone);
|
WaveLineFlash(pos);
|
if (addone < waveLineList.Count)
|
WaveLineFlash(addone);
|
}
|
|
// Update is called once per frame
|
void Update()
|
{
|
|
}
|
}
|