using DG.Tweening; using Core.Utilities; using UnityEngine; /** * 泡泡炸弹 * @Author: chenxin * @Date: 2020-11-03 17:26:27 */ namespace TowerDefense.Agents { public class BubbleBombAgent : Agent { /// /// 外部赋值,唯一标识一个泡泡炸弹代理 /// public int Id { get; set; } /// /// 正常的特效 /// public ParticleSystem NormalEffect; /// /// 爆炸的特效 /// public ParticleSystem ExplodeEffect; /// /// Peforms the relevant path update /// 执行相关路径更新 /// protected override void PathUpdate() { } /// /// The behaviour for when the agent has been blocked /// 代理被阻止时的行为 /// protected override void OnPartialPathUpdate() { } /// /// 重置数据 /// public void Reset() { CanMove = true; bInDeathState = false; } /// /// 播放正常状态的特效 /// public void PlayNormalEffect() { if (NormalEffect != null) NormalEffect.Play(); } /// /// 停止正常状态的特效 /// public void StopNormalEffect() { if (NormalEffect != null) { NormalEffect.Stop(); NormalEffect.Clear(); } } /// /// 播放爆炸的特效 /// public void PlayExplodeEffect() { if (ExplodeEffect != null) ExplodeEffect.Play(); } /// /// 停止爆炸特效 /// public void StopExplodeEffect() { if (ExplodeEffect != null) { ExplodeEffect.Stop(); ExplodeEffect.Clear(); } } /// /// 获取爆炸特效持续时间,该时间过后会回收gameObject /// public float GetExplodeTime() { return 1.15f; } protected override void Update() { } public override void Initialize() { this.configuration.bInvincible = true; mDefaultScale = this.transform.localScale; Sequence agentTweenSeq = DOTween.Sequence(); var ss = mDefaultScale * 0.3f; this.transform.localScale = this.transform.localScale * 0.3f; Tweener agScale = this.transform.DOScale(mDefaultScale, 0.3f); agentTweenSeq.Append(agScale); agentTweenSeq.AppendCallback(beDamageStart); } } }