Exemplo n.º 1
0
        public NormalBrush(int textureSize, TileTexture tt)
        {
            TextureSize = textureSize;

            if (tt == null)
            {
                return;
            }

            var pixels  = tt.Texture.GetPixels();
            var oldSize = (int)Mathf.Sqrt(pixels.Length);

            var colors = Util.ResizeArray(pixels, _textureSize, oldSize);

            var c         = tt.Collision;
            var collision = new bool[c.Length];

            Array.Copy(c, collision, c.Length);

            _brush = new Brush(colors, new TileProperties(tt.ID), collision);

            _preview = new Texture2D(_textureSize, _textureSize, TextureFormat.ARGB32, false);
            _preview.SetPixels(_brush.Colors);
            _preview.Apply();
        }
Exemplo n.º 2
0
        public NormalBrush(int textureSize, TileTexture tt)
        {
            TextureSize = textureSize;

            if (tt == null)
            {
                return;
            }

            var pixels = tt.Texture.GetPixels();
            var oldSize = (int)Mathf.Sqrt(pixels.Length);

            var colors = Util.ResizeArray(pixels, _textureSize, oldSize);

            var c = tt.Collision;
            var collision = new bool[c.Length];
            Array.Copy(c, collision, c.Length);

            _brush = new Brush(colors, new TileProperties(tt.ID), collision);

            _preview = new Texture2D(_textureSize, _textureSize, TextureFormat.ARGB32, false);
            _preview.SetPixels(_brush.Colors);
            _preview.Apply();
        }