NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Summon/State/SummonStateMineBoom.cs

37 lines
1.0 KiB
C#
Raw Normal View History

2023-11-15 18:25:27 +08:00
namespace Gameplay.Summon
2023-08-22 19:08:45 +08:00
{
using Gameplay.Area;
using Gameplay.Bullet;
using LTGame;
public class SummonStateMineBoom : BaseSummonState
{
2023-10-19 15:00:19 +08:00
private readonly SummonMine _mine;
2023-08-22 19:08:45 +08:00
public SummonStateMineBoom(SummonMine owner) : base(owner, ESummonState.MineBoom)
{
_mine = owner;
}
protected override void _OnEnter(NBaseState exitState, object param)
{
base._OnEnter(exitState, param);
isFinished = true;
nextState = ESummonState.WaitRemove;
var bulletId = _mine.emitBulletId;
2023-11-15 18:25:27 +08:00
var boomDistance = _mine.boomDistance;
2023-08-22 19:08:45 +08:00
// 根据作用区域筛选目标
2023-11-15 18:25:27 +08:00
var selectIndexs = AreaManager.instance.GetCellIndexsAround(owner.transData.cellIndex, boomDistance);
2023-08-22 19:08:45 +08:00
for (var i = 0; i < selectIndexs.Count; ++i)
{
var cellIndex = selectIndexs[i];
BulletManager.instance.EmitBulletFromSummon(bulletId, cellIndex, _mine);
2023-08-22 19:08:45 +08:00
}
}
}
}