NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Bullet/State/BulletStatePosBoom.cs

48 lines
1.3 KiB
C#

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;
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);
// 在指定地点播放爆炸特效
var effectId = owner.configData.DestroyEffectId;
if (effectId > 0)
{
var effectData = EffectManager.instance.PlayEffectById(effectId, owner.rootObj.transform.position);
effectData.owner = owner.sender;
}
}
}
}