public TDGInstance(TDGGame mGame, bool mIsTemporary) { _game = mGame; _isTemporary = mIsTemporary; _field = new Field(); _renderComponents = new List<TDCRender>(); }
public static void CheckForBrains(Field mField, bool mPlaySound = false) { foreach (var entity in mField.GetEntitiesByTag(TDLTags.AffectedByBrain)) entity.GetComponent<TDCMovementTargetAI>().IsPathfinder = mField.HasEntityByTag(TDLTags.Brain); if (!mField.HasEntityByTag(TDLTags.Brain) && mPlaySound) TDLSounds.Play("SoundNoBrains"); }
public TDPPathmap(Field mField) { _field = mField; _entities = new HashSet<Entity>(); _field.TurnActions[TDLTurnActions.Start] += () => WasUpdatedThisTurn = false; InitializeNodes(); }
public TDPPathfinder(Field mField) { _field = mField; _pathmaps = new Dictionary<string, TDPPathmap>(); InitializeNodes(); InitializeObstacles(); RefreshObstacles(0, 0, _field.Width, _field.Height); }
private static bool TileHasEntityIgnore(Field mField, int mX, int mY, string mTag, IEnumerable<Entity> mIgnoreEntities, IEnumerable<string> mExceptionTags) { var tempTile = mField.GetTile(mX, mY); if (tempTile == null) return false; if (mIgnoreEntities == null) mIgnoreEntities = new Entity[] {}; if (mExceptionTags == null) mExceptionTags = new string[] {}; return mField.GetEntitiesByTag(mX, mY, mTag).Where(entity => !mExceptionTags.Any(entity.HasTag)).Any(entity => !mIgnoreEntities.Contains(entity)); }
public static bool IsNextObstacle(Field mField, int mX, int mY, IEnumerable<string> mObstacleTags, IEnumerable<Entity> mIgnoreEntities, IEnumerable<string> mExceptionTags) { return mObstacleTags.Any(x => TileHasEntityIgnore(mField, mX, mY, x, mIgnoreEntities, mExceptionTags)); }
public static bool IsNextAllowed(Field mField, int mX, int mY, IEnumerable<string> mAllowedTags) { return mField.IsTileValid(mX, mY) && mAllowedTags.Any(x => mField.HasEntityByTag(mX, mY, x)); }
internal TileManager(Field mField) { Field = mField; EntitiesToUpdate = new List<Entity>(); Repository = new Repository(); }