Exemplo n.º 1
0
        protected override ITextureResource ClientCreateIcon()
        {
            this.InitProceduralTextureAtlas();
            var chunkPreset = FloorTextureChunkSelector.GetRegion(NeighborsPattern.None);

            return(this.proceduralTextureAtlasPrimary.Chunk(chunkPreset.TargetColumn, chunkPreset.TargetRow));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns rectangle (region of texture) according to the nearby walls of the same type
        /// </summary>
        private FloorChunkPreset GetAtlasTextureChunkPosition(Tile tile)
        {
            var sameTypeNeighbors = NeighborsPattern.None;

            var eightNeighborTiles = tile.EightNeighborTiles;
            var tileIndex          = -1;

            foreach (var neighborTile in eightNeighborTiles)
            {
                tileIndex++;
                foreach (var o in neighborTile.StaticObjects)
                {
                    if (o.ProtoWorldObject != this ||
                        o.IsDestroyed)
                    {
                        continue;
                    }

                    // found same floor type in neighbor tile
                    sameTypeNeighbors |= NeighborsPatternDirections.NeighborDirectionSameType[tileIndex];
                    break;
                }
            }

            return(FloorTextureChunkSelector.GetRegion(sameTypeNeighbors));
        }