Пример #1
0
    // void LateUpdate() {
    //   UpdatePosition();
    //  }

    // Management
    static public LightingMeshRenderer AddBuffer(Object source)
    {
        // LightingManager2D manager = LightingManager2D.Get();
        // if (manager.fixedLightBufferSize) {
        //     textureSize = LightingManager2D.GetTextureSize(manager.fixedLightTextureSize);
        // }

        MeshRendererManager manager = Get();

        if (manager == 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             = "Mesh Renderer " + (LightingMeshRenderer.GetCount() + 1);
        buffer.transform.parent = manager.transform;
        buffer.layer            = LightingManager2D.lightingLayer;

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

        lightingBuffer.Initialize();

        lightingBuffer.owner = source;
        lightingBuffer.free  = false;

        //lightingBuffer.lightSource = light; // Unnecessary?
        //lightingBuffer.free = false;
        //lightingBuffer.bufferCamera.orthographicSize = light.lightSize;

        return(lightingBuffer);
    }
Пример #2
0
    // void LateUpdate() {
    //   UpdatePosition();
    //  }

    // Management
    static public LightingMeshRenderer AddBuffer(Object source)
    {
        // LightingManager2D manager = LightingManager2D.Get();
        // if (manager.fixedLightBufferSize) {
        //     textureSize = LightingManager2D.GetTextureSize(manager.fixedLightTextureSize);
        // }

        MeshRendererManager manager = Get();

        if (manager == 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             = "Mesh Renderer (Id :" + (LightingMeshRenderer.GetCount() + 1) + ")";
        buffer.transform.parent = manager.transform;

        if (Lighting2D.ProjectSettings.managerInternal == LightingSettings.ManagerInternal.HideInHierarchy)
        {
            buffer.hideFlags = HideFlags.HideInHierarchy;
        }
        else
        {
            buffer.hideFlags = HideFlags.None;
        }

        LightingMeshRenderer lightingBuffer2D = buffer.AddComponent <LightingMeshRenderer> ();

        lightingBuffer2D.Initialize();

        lightingBuffer2D.owner = source;
        lightingBuffer2D.free  = false;

        return(lightingBuffer2D);
    }