예제 #1
0
파일: TerrianBlock.cs 프로젝트: will3/cfire
        public int[] GetTextureIds()
        {
            if (this.type == TerrianBlockType.Soil)
            {
                var list = new List <int> ();
                for (var i = 0; i < 6; i++)
                {
                    Dir gravity  = DirUtils.GetDir(i);
                    Dir opposite = DirUtils.GetOpposite(gravity);

                    if (!belowWater && HasGravity(gravity))
                    {
                        list.Add(textureIds [TerrianBlockType.Grass]);
                    }
                    else if (!belowWater && !HasGravity(opposite) && !hasTop)
                    {
                        list.Add(textureIds [TerrianBlockType.GrassWithSoil]);
                    }
                    else
                    {
                        list.Add(textureIds [TerrianBlockType.Soil]);
                    }
                }
                return(list.ToArray());
            }
            var textureId = textureIds [type];

            return(new [] { textureId, textureId, textureId, textureId, textureId, textureId });
        }
예제 #2
0
        public Surface GetSurface(Vector3i coordBelow, Vector3i coordAbove)
        {
            if (!map.ContainsKey(coordBelow))
            {
                return(null);
            }

            var block = map [coordBelow];

            var dir = DirUtils.GetDir(coordAbove - coordBelow);

            if (dir == Dir.None)
            {
                return(null);
            }

            if (!block.surfaceMap.ContainsKey(dir))
            {
                return(null);
            }

            return(block.surfaceMap [dir]);
        }