예제 #1
0
 public TDGInstance(TDGGame mGame, bool mIsTemporary)
 {
     _game = mGame;
     _isTemporary = mIsTemporary;
     _field = new Field();
     _renderComponents = new List<TDCRender>();
 }
예제 #2
0
        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");
        }
예제 #3
0
        public TDPPathmap(Field mField)
        {
            _field = mField;
            _entities = new HashSet<Entity>();

            _field.TurnActions[TDLTurnActions.Start] += () => WasUpdatedThisTurn = false;

            InitializeNodes();
        }
예제 #4
0
        public TDPPathfinder(Field mField)
        {
            _field = mField;
            _pathmaps = new Dictionary<string, TDPPathmap>();

            InitializeNodes();
            InitializeObstacles();
            RefreshObstacles(0, 0, _field.Width, _field.Height);
        }
예제 #5
0
        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));
        }
예제 #6
0
 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));
 }
예제 #7
0
 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));
 }
예제 #8
0
 internal TileManager(Field mField)
 {
     Field = mField;
     EntitiesToUpdate = new List<Entity>();
     Repository = new Repository();
 }