Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        OverFrames of = OverFrames.Get();

        of.For(0, 20, 200, i => {
            Debug.Log(i);
        },
               () => {
            Debug.Log("Ended");
        });
    }
Ejemplo n.º 2
0
    void Start()
    {
        // Spread a For loop from x to y over n frames
        int x = 0;
        int y = 100000000;
        int n = 50;

        OverFrames.For(x, y, n,
                       i => {
            float value = i * Random.value;
            Log(value);
        },
                       () => { }
                       );
    }
Ejemplo n.º 3
0
        void Scan()
        {
            doScan = false;

            OverFrames.Get().For(0, rayRows, frameLength, i => {
                for (int j = 0; j < rayCols; j++)
                {
                    var screenPoint = new Vector3(j * (float)Screen.width / rayCols, i * (float)Screen.height / rayRows);
                    var ray         = camera.ScreenPointToRay(screenPoint);
                    rays.Add(ray);

                    if (Physics.Raycast(ray, out hit, camera.farClipPlane))
                    {
                        var collider = hit.collider;
                        if (collider == null)
                        {
                            break;
                        }
                        var ocr = collider.GetComponent <OcclusionCulledRenderer>();
                        if (ocr != null)
                        {
                            if (!scannedRenderers.Contains(ocr))
                            {
                                scannedRenderers.Add(ocr);
                            }
                        }
                    }
                }
            },
                                 () => {
                for (int i = 0; i < occCullRenderers.Count; i++)
                {
                    if (scannedRenderers.Contains(occCullRenderers[i]))
                    {
                        occCullRenderers[i].MakeVisible();
                    }
                    else
                    {
                        occCullRenderers[i].MakeInvisible();
                    }
                }
                scannedRenderers.Clear();
                doScan = true;
            });
        }