using Gameplay.Area; using Gameplay.Buff; using Gameplay.Effect; using LTGame; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Gameplay.PostProcess.BlackArea; namespace Gameplay.Bullet { public class BulletStatePosBoom : BaseBulletState { public BulletStatePosBoom(ViewBullet owner): base(owner, EBulletState.PosBoom) { } protected override void _OnEnter(NBaseState exitState, object param) { base._OnEnter(exitState, param); isFinished = true; nextState = EBulletState.Destroy; // 获取当前位置 if (!owner.map.WorldPosition2TGSCellIndex(owner.rootObj.transform.position, out var currentCellIndex)) { DebugUtil.LogError("转换坐标出错:{0}", owner.rootObj.transform.position); return; } BulletManager.instance.AddBuffs2CellIndex(currentCellIndex, owner.sender, owner.configData); if (owner.configData.LightDuring > 0) { BlackAreaManager.instance.LightUpCell(currentCellIndex, owner.configData.LightDuring); } // 在指定地点播放爆炸特效 var effectId = owner.configData.DestroyEffectId; if (effectId > 0) { var effectData = EffectManager.instance.PlayEffectById(effectId, owner.rootObj.transform.position); effectData.owner = owner.sender; } } } }