31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using cfg;
|
||
|
|
using Framework;
|
||
|
|
using Framework.Condition;
|
||
|
|
using Gameplay.Character;
|
||
|
|
using Gameplay.Level;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class ConditionCombatFallBack : ICondition
|
||
|
|
{
|
||
|
|
public EventManager.EventName SignalName => EventManager.EventName.LevelCharacterArriveBlock;
|
||
|
|
|
||
|
|
public bool Check(List<float> args)
|
||
|
|
{
|
||
|
|
if (!LevelManager.Instance.IsInLevel)
|
||
|
|
throw new Exception("current level is null!");
|
||
|
|
var level = LevelManager.Instance.CurrentLevel;
|
||
|
|
var position = new Vector2Int((int)args[0], (int)args[1]);
|
||
|
|
var characterManager = level.CharacterManager;
|
||
|
|
var map = level.Map;
|
||
|
|
var characterYes = characterManager.FindOne(character =>
|
||
|
|
character.transData.cellIndex == map.BlockPosition2TGSCellIndex(position)
|
||
|
|
&& character.troopId == ETroopsId.Self);
|
||
|
|
var characterNo = characterManager.FindOne(character =>
|
||
|
|
character.transData.cellIndex != map.BlockPosition2TGSCellIndex(position)
|
||
|
|
&& character.troopId == ETroopsId.Self);
|
||
|
|
|
||
|
|
return characterYes != null && characterNo == null;
|
||
|
|
}
|
||
|
|
}
|