53 lines
1.6 KiB
C#
53 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using Gameplay.Area;
|
|
using Gameplay.Area.AttackArea;
|
|
namespace Gameplay.Summon.Logic
|
|
{
|
|
public class SLogicSetSmoke : BaseSummonLogic
|
|
{
|
|
|
|
public int distance;
|
|
public int centerCellIndex;
|
|
|
|
private IList<int> _cellIndexList;
|
|
private IList<TempBlockData> _tempBlockDataList;
|
|
|
|
public SLogicSetSmoke(BaseSummon summon) : base(summon)
|
|
{
|
|
_tempBlockDataList = new List<TempBlockData>();
|
|
}
|
|
|
|
protected override void _OnInit()
|
|
{
|
|
base._OnInit();
|
|
_tempBlockDataList.Clear();
|
|
|
|
_cellIndexList = AreaManager.instance.GetCellIndexsAround(centerCellIndex, distance, true);
|
|
|
|
for (int i = 0; i < _cellIndexList.Count; i++)
|
|
{
|
|
var cellIndex = _cellIndexList[i];
|
|
var hasBlock = AreaManager.instance.attackAreaManager.CheckHasBlockAttackCell(cellIndex);
|
|
if (hasBlock) continue;
|
|
var tempBlock = AreaManager.instance.attackAreaManager.CreateBlockAttackCell(cellIndex);
|
|
_tempBlockDataList.Add(tempBlock);
|
|
}
|
|
}
|
|
|
|
protected override void _OnDispose()
|
|
{
|
|
base._OnDispose();
|
|
|
|
for (int i = 0; i < _tempBlockDataList.Count; i++)
|
|
{
|
|
var tempBlock = _tempBlockDataList[i];
|
|
if (tempBlock != null)
|
|
{
|
|
AreaManager.instance.attackAreaManager.RemoveBlockAttackCell(tempBlock.blockCellIndex);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|