Ejemplo n.º 1
0
    public override void OnReady2Do()
    {
        base.OnReady2Do();
        if (material == null)
        {
            material = new Material(Shader.Find("Scene Manager/Tiles Effect"));
            material.SetTexture("_Backface", Texture2D.blackTexture);
            material.SetTexture("_Background", Texture2D.blackTexture);
        }

        topLeft = Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, distance));

        bottomRight = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, distance));

        width  = bottomRight.x - topLeft.x;
        height = topLeft.y - bottomRight.y;

        columns = Mathf.FloorToInt(Screen.width / TransitionUtils.ToAbsoluteSize(preferredTileSize.x, Screen.width));
        rows    = Mathf.FloorToInt(Screen.height / TransitionUtils.ToAbsoluteSize(preferredTileSize.y, Screen.height));

        // recalculate size to avoid clipped tiles
        actualTileSize = new Vector2(width / columns, height / rows);

        tileStartOffset = (duration - tilesFlipTime) / (columns + rows);
    }
Ejemplo n.º 2
0
    public override void OnReady2Do()                         // 准备
    {
        base.OnReady2Do();
        if (material == null)
        {
            material = new Material(Shader.Find("Scene Manager/Tetris Effect"));
            material.SetTexture("_Background", Texture2D.blackTexture);
        }

        duration       = 0;
        columns        = Mathf.FloorToInt(Screen.width / TransitionUtils.ToAbsoluteSize(preferredTileSize.x, Screen.width));
        rows           = Mathf.FloorToInt(Screen.height / TransitionUtils.ToAbsoluteSize(preferredTileSize.y, Screen.height));
        actualTileSize = new Vector2(1f / columns, 1f / rows);

        tiles = new List <Tile>(columns * rows);
        for (int x = 0; x < columns; x++)
        {
            float startTime = 0;
            for (int y = 0; y < rows; y++)
            {
                startTime += UnityEngine.Random.Range(minDelayBetweenTiles, maxDelayBetweenTiles);
                tiles.Add(new Tile(x, y,
                                   new Vector2(x * actualTileSize.x, y * actualTileSize.y + (IsOut ? 0 : 1)),
                                   startTime));
                duration = Mathf.Max(duration, startTime);
            }
        }

        duration += tileFallTime;
    }
Ejemplo n.º 3
0
    public override void OnReady2Do()
    {
        int preferredHeightInPixel = TransitionUtils.ToAbsoluteSize(BlindsHeight, Screen.height);

        numberOfBlinds     = Mathf.FloorToInt(Screen.height / preferredHeightInPixel);
        actualBlindsHeight = (float)Screen.height / (float)numberOfBlinds;
        blindsStartOffset  = (duration - BlindsTime) / (float)numberOfBlinds;
    }
Ejemplo n.º 4
0
    public override void OnReady2Do()                         // 准备
    {
        base.OnReady2Do();

        duration = fadeOutStartTime + fadeOutDuration;
        float borderSizeInPixel = TransitionUtils.ToAbsoluteSize(borderSize, Screen.height);

        actualBorderSize = borderSizeInPixel / Screen.height;
    }
Ejemplo n.º 5
0
    public override void OnReady2Do()
    {
        base.OnReady2Do();
        if (material == null)
        {
            material = new Material(Shader.Find("Scene Manager/Cartoon Effect"));
            material.SetTexture("_Background", Texture2D.blackTexture);
        }

        Vector2 pixelCenter = new Vector2(TransitionUtils.ToAbsoluteSize(center.x, Screen.width), TransitionUtils.ToAbsoluteSize(center.y, Screen.height));

        Vector2 bottomLeftPath  = pixelCenter - new Vector2(0, 0);
        Vector2 topLeftPath     = pixelCenter - new Vector2(0, Screen.height);
        Vector2 topRightPath    = pixelCenter - new Vector2(Screen.width, Screen.height);
        Vector2 bottomRightPath = pixelCenter - new Vector2(Screen.width, 0);

        length = Mathf.Max(bottomLeftPath.magnitude, topLeftPath.magnitude, topRightPath.magnitude, bottomRightPath.magnitude);
        material.SetFloat("_CenterX", pixelCenter.x);
        material.SetFloat("_CenterY", pixelCenter.y);

        material.SetColor("_BorderColor", borderColor);
    }