62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Gameplay.Summon
|
|
{
|
|
using Gameplay.Area;
|
|
using Gameplay.Bullet;
|
|
using Gameplay.Skill;
|
|
using LTGame;
|
|
|
|
public class SummonStateTent : BaseSummonState
|
|
{
|
|
|
|
private readonly SummonTent _tent;
|
|
|
|
private float _remainTriggerTime;
|
|
|
|
public SummonStateTent(SummonTent tent) : base(tent, ESummonState.Tent)
|
|
{
|
|
_tent = tent;
|
|
}
|
|
|
|
protected override void _OnEnter(NBaseState exitState, object param)
|
|
{
|
|
base._OnEnter(exitState, param);
|
|
_remainTriggerTime = _tent.triggerInterval;
|
|
}
|
|
|
|
protected override void _OnRunning()
|
|
{
|
|
base._OnRunning();
|
|
_remainTriggerTime -= deltaTime;
|
|
if (_remainTriggerTime <= 0)
|
|
{
|
|
_remainTriggerTime += _tent.triggerInterval;
|
|
_DoLogic();
|
|
}
|
|
}
|
|
|
|
private void _DoLogic()
|
|
{
|
|
var bulletId = _tent.emitBulletId;
|
|
var areaId = _tent.areaId;
|
|
|
|
// 根据作用区域筛选目标
|
|
var selectIndexs = AreaManager.instance.GetCellIndexs(owner.transData.cellIndex, areaId);
|
|
|
|
for (var i = 0; i < selectIndexs.Count; ++i)
|
|
{
|
|
var cellIndex = selectIndexs[i];
|
|
BulletManager.instance.EmitBulletFromSummon(bulletId, cellIndex, _tent);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|