Ejemplo n.º 1
0
        private void GenerateRippleTexture()
        {
            var texSize = GetRippleTextureSize();

            _generatedTexture    = TextureStaticFactory.CreateCircleTexture(_color, texSize, texSize, texSize / 2, texSize / 2, texSize / 2);
            _rippleSprite.sprite = Sprite.Create(
                _generatedTexture,
                new Rect(Vector2.zero, new Vector2(texSize, texSize)),
                Vector2.zero,
                100,
                1,
                SpriteMeshType.FullRect);
        }
Ejemplo n.º 2
0
        private void GenerateRippleTexture()
        {
            var texSize = GetRippleSize();

            _generatedTexture    = TextureStaticFactory.CreateCircleTexture(_rippleColor, texSize, texSize, texSize / 2, texSize / 2, texSize / 2);
            _rippleSprite.sprite = Sprite.Create(
                _generatedTexture,
                new Rect(Vector2.zero, new Vector2(texSize, texSize)),
                Vector2.zero,
                UiCanvasHelper.Instance.PixelsPerUnit,
                1,
                SpriteMeshType.FullRect);
        }
Ejemplo n.º 3
0
        private void Test_CreateCircleTexture(int width, int height, int x, int y, int radius, Stopwatch sw)
        {
            sw.Restart();
            var tex = TextureStaticFactory.CreateCircleTexture(Color.white, width, height, x, y, radius);

            for (int i = 0; i < _cycles; i++)
            {
                TextureStaticFactory.ReturnTexture(tex);
                var _generatedTexture = TextureStaticFactory.CreateCircleTexture(Color.white, width, height, x, y, radius);
                Sprite.Create(
                    _generatedTexture,
                    new Rect(Vector2.zero, new Vector2(width, height)),
                    Vector2.zero,
                    100,
                    1,
                    SpriteMeshType.FullRect);
            }
            print($"{nameof(Test_CreateCircleTexture)} - {sw.ElapsedMilliseconds}ms");
        }