示例#1
0
        private List <Neighbor> gatherNeighbors(GameLocation loc, Vector2 tilePos)
        {
            List <Neighbor> results = _neighbors;

            results.Clear();
            TerrainFeature feature = null;
            HoeDirt        dirt    = null;
            NetVector2Dictionary <TerrainFeature, NetRef <TerrainFeature> > terrainFeatures = loc.terrainFeatures;

            NeighborLoc[] offsets = _offsets;
            for (int j = 0; j < offsets.Length; j++)
            {
                NeighborLoc item = offsets[j];
                Vector2     tile = tilePos + item.Offset;
                if (terrainFeatures.TryGetValue(tile, out feature) && feature != null)
                {
                    dirt = feature as HoeDirt;
                    if (dirt != null && dirt.state.Value != 2)
                    {
                        Neighbor i = new Neighbor(dirt, item.Direction, item.InvDirection);
                        results.Add(i);
                    }
                }
            }
            return(results);
        }
示例#2
0
        private List <Neighbor> gatherNeighbors(GameLocation loc, Vector2 tilePos)
        {
            List <Neighbor> results = _neighbors;

            results.Clear();
            TerrainFeature feature  = null;
            Flooring       flooring = null;
            NetVector2Dictionary <TerrainFeature, NetRef <TerrainFeature> > terrainFeatures = loc.terrainFeatures;

            NeighborLoc[] offsets = _offsets;
            for (int k = 0; k < offsets.Length; k++)
            {
                NeighborLoc item = offsets[k];
                Vector2     tile = tilePos + item.Offset;
                if (loc.map != null && !loc.isTileOnMap(tile))
                {
                    Neighbor j = new Neighbor(null, item.Direction, item.InvDirection);
                    results.Add(j);
                }
                else if (terrainFeatures.TryGetValue(tile, out feature) && feature != null)
                {
                    flooring = feature as Flooring;
                    if (flooring != null && flooring.whichFloor == whichFloor)
                    {
                        Neighbor i = new Neighbor(flooring, item.Direction, item.InvDirection);
                        results.Add(i);
                    }
                }
            }
            return(results);
        }
示例#3
0
        private List <Neighbor> gatherNeighbors(GameLocation loc, Vector2 tilePos)
        {
            List <Neighbor> results = _neighbors;

            results.Clear();
            TerrainFeature feature   = null;
            Flooring       flooring2 = null;
            NetVector2Dictionary <TerrainFeature, NetRef <TerrainFeature> > terrainFeatures = loc.terrainFeatures;

            NeighborLoc[] offsets = _offsets;
            for (int j = 0; j < offsets.Length; j++)
            {
                NeighborLoc item = offsets[j];
                Vector2     tile = tilePos + item.Offset;
                if (terrainFeatures.TryGetValue(tile, out feature) && feature != null)
                {
                    flooring2 = (feature as Flooring);
                    if (flooring2 != null && flooring2.whichFloor == whichFloor)
                    {
                        Neighbor i = new Neighbor(flooring2, item.Direction, item.InvDirection);
                        results.Add(i);
                    }
                }
            }
            return(results);
        }