示例#1
0
        public static TileMask fromData(byte[] data)
        {
            TileMask mask = new TileMask();

            mask.mask = data;
            return(mask);
        }
示例#2
0
        public static TileMask fromTexture(Texture2D texture)
        {
            TileMask mask = new TileMask();

            Color[] colors = new Color[mask.width * mask.height];
            texture.GetData <Color>(colors);

            for (int y = 0; y < mask.height; y++)
            {
                for (int x = 0; x < mask.width; x++)
                {
                    if (colors[x + y * mask.width] == Color.Black)
                    {
                        mask.mask[x + y * mask.width] = 1;
                    }
                }
            }

            return(mask);
        }
示例#3
0
 public Tile(TileSet tileSet, TileMask mask, uint tileId)
 {
     this.tileSet = tileSet;
     this.mask    = mask;
     this.tileId  = tileId;
 }