createSingleColorTexture() public static method

helper method that generates a single color texture of the given dimensions
public static createSingleColorTexture ( int width, int height, Color color ) : Microsoft.Xna.Framework.Graphics.Texture2D
width int Width.
height int Height.
color Color Color.
return Microsoft.Xna.Framework.Graphics.Texture2D
        public override IEnumerator onBeginTransition()
        {
            // create a single pixel transparent texture so we can do our squares out to the next scene
            _overlayTexture = Graphics.createSingleColorTexture(1, 1, Color.Transparent);

            // populate squares
            yield return(Core.startCoroutine(tickEffectProgressProperty(_squaresEffect, squaresInDuration, easeType)));

            // load up the new Scene
            yield return(Core.startCoroutine(loadNextScene()));

            // dispose of our previousSceneRender. We dont need it anymore.
            previousSceneRender.Dispose();
            previousSceneRender = null;

            // delay
            yield return(delayBeforeSquaresInDuration);

            // unpopulate squares
            yield return(Core.startCoroutine(tickEffectProgressProperty(_squaresEffect, squaresInDuration, EaseHelper.oppositeEaseType(easeType), true)));

            transitionComplete();

            // cleanup
            _overlayTexture.Dispose();
            Core.contentManager.unloadEffect(_squaresEffect.Name);
        }
        public WaterReflectionPlane(float width, float height)
        {
            // we need a separate texture (not part of an atlas) so that we get uvs in the 0 - 1 range that the Effect requires
            _texture = Graphics.createSingleColorTexture(1, 1, Color.Bisque);
            _width   = width;
            _height  = height;

            _waterReflectionMaterial = new WaterReflectionMaterial();
        }
Beispiel #3
0
        public override IEnumerator onBeginTransition()
        {
            // create a single pixel texture of our fadeToColor
            _overlayTexture = Graphics.createSingleColorTexture(1, 1, fadeToColor);

            var elapsed = 0f;

            while (elapsed < fadeOutDuration)
            {
                elapsed += Time.deltaTime;
                _color   = Lerps.ease(fadeEaseType, ref _toColor, ref _fromColor, elapsed, fadeOutDuration);

                yield return(null);
            }

            // load up the new Scene
            yield return(Core.startCoroutine(loadNextScene()));

            // dispose of our previousSceneRender. We dont need it anymore.
            previousSceneRender.Dispose();
            previousSceneRender = null;

            yield return(Coroutine.waitForSeconds(delayBeforeFadeInDuration));

            elapsed = 0f;
            while (elapsed < fadeInDuration)
            {
                elapsed += Time.deltaTime;
                _color   = Lerps.ease(
                    EaseHelper.oppositeEaseType(fadeEaseType),
                    ref _fromColor,
                    ref _toColor,
                    elapsed,
                    fadeInDuration);

                yield return(null);
            }

            transitionComplete();
            _overlayTexture.Dispose();
        }