Esempio n. 1
0
    // Management
    static public LightingBuffer2D AddBuffer(int textureSize, LightingSource2D light)
    {
        LightingManager2D manager = LightingManager2D.Get();

        if (manager.fixedLightBufferSize)
        {
            textureSize = LightingManager2D.GetTextureSize(manager.fixedLightTextureSize);
        }

        FBOManager fboManager = LightingManager2D.Get().fboManager;

        if (fboManager == null)
        {
            Debug.LogError("Lighting Manager Instance is Out-Dated.");
            Debug.LogError("Try Re-Initializing 'Lighting Manager 2D' Component");
            return(null);
        }

        GameObject buffer = new GameObject();

        buffer.name             = "Buffer " + GetCount();
        buffer.transform.parent = LightingManager2D.Get().fboManager.transform;
        buffer.layer            = LightingManager2D.lightingLayer;

        LightingBuffer2D lightingBuffer = buffer.AddComponent <LightingBuffer2D> ();

        lightingBuffer.Initiate(textureSize);
        lightingBuffer.lightSource = light;         // Unnecessary?
        lightingBuffer.free        = false;
        lightingBuffer.bufferCamera.orthographicSize = light.lightSize;

        return(lightingBuffer);
    }
Esempio n. 2
0
    // Management
    static public LightingBuffer2D AddBuffer(Vector2Int textureSize, Light2D light)       // i
    {
        Get();

        LightingBuffer2D lightingBuffer2D = new LightingBuffer2D();

        lightingBuffer2D.Initiate(textureSize);
        lightingBuffer2D.Light = light;         // Unnecessary?

        return(lightingBuffer2D);
    }
Esempio n. 3
0
    static public LightingBuffer2D AddBuffer(int textureSize)
    {
        GameObject buffer = new GameObject();

        buffer.name             = "Buffer " + GetCount();
        buffer.transform.parent = LightingManager2D.Get().mainBuffer.transform;
        buffer.layer            = LightingManager2D.lightingLayer;

        LightingBuffer2D lightingBuffer = buffer.AddComponent <LightingBuffer2D> ();

        lightingBuffer.Initiate(textureSize);

        return(lightingBuffer);
    }