예제 #1
0
    private void DrawTiles()
    {
        var material = mode == Mode.AnimateLevelContents ? shaderMaterial : backgroundMaterial;

        for (var i = 0; i < material.passCount; ++i)
        {
            material.SetPass(i);
            GL.Begin(GL.QUADS);

            foreach (Tile tile in tiles)
            {
                float   tileProgress = SMTransitionUtils.SmoothProgress(tile.startTime, tileFallTime, effectTime);
                Vector2 position     = tile.position - Vector2.up * tileProgress;             // move the tile down

                if (position.y < 1 && position.y >= (-actualTileSize.y))
                {
                    GL.TexCoord3(tile.column * actualTileSize.x, tile.row * actualTileSize.y, 0);
                    GL.Vertex3(position.x, position.y, 0);
                    GL.TexCoord3(tile.column * actualTileSize.x, (tile.row + 1) * actualTileSize.y, 0);
                    GL.Vertex3(position.x, position.y + actualTileSize.y, 0);
                    GL.TexCoord3((tile.column + 1) * actualTileSize.x, (tile.row + 1) * actualTileSize.y, 0);
                    GL.Vertex3(position.x + actualTileSize.x, position.y + actualTileSize.y, 0);
                    GL.TexCoord3((tile.column + 1) * actualTileSize.x, tile.row * actualTileSize.y, 0);
                    GL.Vertex3(position.x + actualTileSize.x, position.y, 0);
                }
            }
            GL.End();
        }
    }
예제 #2
0
 public void OnGUI()
 {
     GUI.depth = 0;
     for (int i = 0; i < numberOfBlinds; i++)
     {
         float progress      = SMTransitionUtils.SmoothProgress(i * blindsStartOffset, blindsFlipTime, effectTime);
         float visibleHeight = actualBlindsHeight * progress;
         GUI.DrawTexture(new Rect(0, i * actualBlindsHeight + (actualBlindsHeight - visibleHeight) / 2f, Screen.width, visibleHeight), blindsTexture);
     }
 }
예제 #3
0
    protected override bool Process(float elapsedTime)
    {
        float effectTime = elapsedTime;

        // invert direction if necessary
        if (state == SMTransitionState.In)
        {
            effectTime = duration - effectTime;
        }

        progress = SMTransitionUtils.SmoothProgress(0, duration, effectTime);

        return(elapsedTime < duration);
    }
예제 #4
0
 protected override bool Process(float elapsedTime)
 {
     effectTime = elapsedTime - simplifiedShaderLagCompensation;
     // calculation phase.
     for (int x = 0; x < columns; x++)
     {
         for (int y = 0; y < rows; y++)
         {
             float tileProgress = SMTransitionUtils.SmoothProgress((x + y) * tileStartOffset, tilesFlipTime, effectTime);
             CalculateTile(x, y, tileProgress * 180);
         }
     }
     return(effectTime < duration);
 }
예제 #5
0
    protected override bool Process(float elapsedTime)
    {
        float effectTime = elapsedTime - simplifiedShaderLagCompensation;
        float calcBase   = effectTime;

        // invert direction
        if (state == SMTransitionState.In)
        {
            calcBase = duration - effectTime;
        }

        progress = SMTransitionUtils.SmoothProgress(0, duration, calcBase);

        return(effectTime < duration);
    }
예제 #6
0
    protected override bool Process(float elapsedTime)
    {
        float effectTime = elapsedTime;

        // invert direction
        if (state == SMTransitionState.In)
        {
            effectTime = duration - effectTime;
        }

        borderProgress = SMTransitionUtils.SmoothProgress(borderStartOffset, borderSlideDuration, effectTime);
        tintProgress   = SMTransitionUtils.SmoothProgress(tintStartOffset, tintDuration, effectTime);
        fadeProgress   = SMTransitionUtils.SmoothProgress(fadeOutStartOffset, fadeOutDuration, effectTime);

        return(elapsedTime < duration);
    }
예제 #7
0
    private void DrawPieces(float time)
    {
        var material = state == SMTransitionState.Out ? shaderMaterial : backgroundMaterial;

        for (var i = 0; i < material.passCount; ++i)
        {
            material.SetPass(i);
            GL.Begin(GL.QUADS);

            Vector3 progress = new Vector3(0, -Screen.height * SMTransitionUtils.SmoothProgress(cutDuration, pieceFallTime, time), 0);
            GL.TexCoord3(0, 0, 0);
            GL.Vertex3(0, progress.y, 0);
            GL.TexCoord3(0, .2f, 0);
            GL.Vertex(firstCutStart + progress);
            GL.TexCoord3(1, .4f, 0);
            GL.Vertex(firstCutEnd + progress);
            GL.TexCoord3(1, 0, 0);
            GL.Vertex3(Screen.width, progress.y, 0);

            progress = new Vector3(0, -Screen.height * SMTransitionUtils.SmoothProgress(2 * cutDuration + delayBetweenCuts, pieceFallTime, time), 0);
            GL.TexCoord3(0, .2f, 0);
            GL.Vertex(firstCutStart + progress);
            GL.TexCoord3(0, .9f, 0);
            GL.Vertex(secondCutEnd + progress);
            GL.TexCoord3(1, .6f, 0);
            GL.Vertex(secondCutStart + progress);
            GL.TexCoord3(1, .4f, 0);
            GL.Vertex(firstCutEnd + progress);

            progress = new Vector3(0, -Screen.height * SMTransitionUtils.SmoothProgress(2 * cutDuration + 2 * delayBetweenCuts, pieceFallTime, time), 0);
            GL.TexCoord3(0, .9f, 0);
            GL.Vertex(secondCutEnd + progress);
            GL.TexCoord3(0, 1, 0);
            GL.Vertex3(0, Screen.height + progress.y, 0);
            GL.TexCoord3(1, 1, 0);
            GL.Vertex3(Screen.width, Screen.height + progress.y, 0);
            GL.TexCoord3(1, .6f, 0);
            GL.Vertex(secondCutStart + progress);

            GL.End();
        }
    }