using System; using System.Collections.Generic; using System.Linq; using ProtoCSClass; #if UNITY_2019_1_OR_NEWER using ILLitJson; #else using LitJson; #endif using Sog; namespace Battle { internal static class BattleObjExt { public static BattleHero GetHeroByObjId(this BattleObj battle, uint objId, bool isAlive) { foreach (BattleHero creat in battle.allCreatures) { if (creat.objId == objId) { if (! isAlive) { return creat; } return creat.isDead ? null : creat; } } return null; } } }