55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
using DarkTonic.MasterAudio;
|
|
using DG.Tweening;
|
|
using DragonLi.Core;
|
|
using Mirror;
|
|
using UnityEngine;
|
|
|
|
public class PowerCore : Tower
|
|
{
|
|
//public cPowerEnergy cPowerEnergy;
|
|
public GameObject[] explosions;
|
|
public GameObject buffparticle;
|
|
|
|
[SoundGroup] public string runningSound;
|
|
|
|
[Server]
|
|
public override void OnSpawn(int id, TowerType type, int lvl)
|
|
{
|
|
base.OnSpawn(id, type, lvl);
|
|
DOVirtual.Float(0, 1, 5, (res) =>
|
|
{
|
|
//cPowerEnergy._OpenShield = res;
|
|
});
|
|
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
|
{
|
|
PlaySound(runningSound);
|
|
}, 1f);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 死亡
|
|
/// </summary>
|
|
public override void Die(object info, Transform _sender)
|
|
{
|
|
Debug.Log("基地被摧毁");
|
|
state = TowerState.Broken;
|
|
ColliderComponent.enabled = false;
|
|
ShowExplosion();
|
|
// 5秒后游戏结束
|
|
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
|
{
|
|
// GameManager.Ins.GameState = GameState.Failure;
|
|
// GameManager.Ins.GameEnd();
|
|
}, 5f);
|
|
}
|
|
|
|
[ClientRpc]
|
|
public void ShowExplosion()
|
|
{
|
|
buffparticle.SetActive(false);
|
|
explosions[0].SetActive(true);
|
|
explosions[1].SetActive(true);
|
|
explosions[2].SetActive(true);
|
|
}
|
|
}
|