private void DrawTiles() { material.SetFloat("_BlendMode", 1); for (var i = 0; i < material.passCount; ++i) { material.SetPass(i); GL.Begin(GL.QUADS); foreach (Tile tile in tiles) { float tileProgress = TransitionUtils.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(); } }
public override bool OnProcessAnim(float elapsedTime) { float effectTime = elapsedTime; if (IsOut == false) { effectTime = duration - effectTime; } progress = TransitionUtils.SmoothProgress(0, duration, effectTime); return(elapsedTime < duration); }
public override bool OnProcessAnim(float elapsedTime) // While 控制动画播放时间 { float effectTime = elapsedTime; if (!IsOut) { effectTime = duration - effectTime; } pixelateProgress = TransitionUtils.SmoothProgress(StartOffset, Duration, effectTime); fadeProgress = TransitionUtils.SmoothProgress(fadeStartOffset, fadeDuration, effectTime); return(elapsedTime < duration); }
void OnGUI() { GUI.depth = 0; Color firstColor = GUI.color; GUI.color = Color.black; for (int i = 0; i < numberOfBlinds; i++) { float progress = TransitionUtils.SmoothProgress(i * blindsStartOffset, BlindsTime, effectTime); float visibleHeight = actualBlindsHeight * progress; GUI.DrawTexture(new Rect(0, i * actualBlindsHeight + (actualBlindsHeight - visibleHeight) / 2f, Screen.width, visibleHeight), Texture2D.whiteTexture); } GUI.color = firstColor; }
public override bool OnProcessAnim(float elapsedTime) // 动画进度 { float effectTime = elapsedTime; // invert direction if (!IsOut) // 如果是进入新场景了 { effectTime = duration - effectTime; } borderProgress = TransitionUtils.SmoothProgress(borderStartTime, borderDuration, effectTime); tintProgress = TransitionUtils.SmoothProgress(tintStartTime, tintDuration, effectTime); fadeProgress = TransitionUtils.SmoothProgress(fadeOutStartTime, fadeOutDuration, effectTime); return(elapsedTime < duration); }
private void DrawPieces(float time) { material.SetFloat("_BlendMode", IsOut ? 1 : 0); for (var i = 0; i < material.passCount; ++i) { material.SetPass(i); GL.Begin(GL.QUADS); Vector3 progress = new Vector3(0, -Screen.height * TransitionUtils.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 * TransitionUtils.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 * TransitionUtils.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(); } }
protected override void OnLastRenderer2Do() { base.OnLastRenderer2Do(); GL.PushMatrix(); DrawBackground(); GL.Clear(true, false, Color.black); for (int x = 0; x < columns; x++) { for (int y = 0; y < rows; y++) { float tileProgress = TransitionUtils.SmoothProgress((x + y) * tileStartOffset, tilesFlipTime, effectTime); DrawTile(x, y, tileProgress * 180); } } GL.PopMatrix(); }