public static List <Entity> FindChildrenFor(this Pool pool, Entity entity) { return(pool .GetEntities(GameMatcher.Child) .Where(x => x.child.ParentId == entity.id.Value) .ToList()); }
public static Entity AddId(this Entity entity, Pool pool) { var identifiables = pool.GetEntities(GameMatcher.Id); var currentId = identifiables.Any() ? identifiables.Max(x => x.id.Value) : 0; entity.AddId(currentId + 1); return(entity); }
public List <Entity> GetExitsForCurrentPuzzle() { var currentBossConnection = _pool.GetCurrentPuzzleArea().bossConnection; return(_pool .GetEntities(GameMatcher.ExitGate) .Where(x => x.bossConnection.BossId == currentBossConnection.BossId) .ToList()); }
public static void SafeDeleteAll(this Pool pool, IMatcher matcher = null, Func <Entity, bool> ignore = null) { IEnumerable <Entity> entities = matcher != null?pool.GetEntities(matcher) : pool.GetEntities(); if (ignore != null) { entities = entities.Where(ignore); } entities.ForEach(x => x.IsDestroyed(true)); }
public static Entity GetActiveBoss(this Pool pool) { try { return(pool .GetEntities(GameMatcher.Boss) .Single(x => !x.isDead)); } catch (Exception) { return(null); } }
private void RemoveLoadedThisTurnOnCharacterMove(Pool pool) { var loadedTraps = pool.GetEntities(Matcher.AllOf(GameMatcher.SpikeTrap, GameMatcher.Loaded)).ToList(); loadedTraps.ForEach(e => e.ReplaceLoaded(false)); }
public static UnityEngine.Camera GetCamera(this Pool pool) { var cameras = pool.GetEntities(GameMatcher.Camera); return(cameras.SingleEntity().camera.Value); }
public static Entity GetHero(this Pool pool) { return(pool.GetEntities(GameMatcher.Hero).SingleOrDefault()); }