Exemplo n.º 1
0
 private void SetOrientation(SplitPair pair, Orientation orientation)
 {
     switch (orientation) {
         case Orientation.CENTER:
             pair.camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
             break;
         case Orientation.LEFT:
             pair.camera.rect = new Rect(0.0f, 0.0f, 0.5f, 1.0f);
             break;
         case Orientation.RIGHT:
             pair.camera.rect = new Rect(0.5f, 0.0f, 0.5f, 1.0f);
             break;
         case Orientation.TOP:
             pair.camera.rect = new Rect(0.0f, 0.5f, 1.0f, 0.5f);
             break;
         case Orientation.BOTTOM:
             pair.camera.rect = new Rect(0.0f, 0.0f, 1.0f, 0.5f);
             break;
         case Orientation.TOP_LEFT:
             pair.camera.rect = new Rect(0.0f, 0.5f, 0.5f, 0.5f);
             break;
         case Orientation.TOP_RIGHT:
             pair.camera.rect = new Rect(0.5f, 0.5f, 0.5f, 0.5f);
             break;
         case Orientation.BOT_LEFT:
             pair.camera.rect = new Rect(0.0f, 0.0f, 0.5f, 0.5f);
             break;
         case Orientation.BOT_RIGHT:
             pair.camera.rect = new Rect(0.5f, 0.0f, 0.5f, 0.5f);
             break;
     }
     pair.hud.SetOrientation(orientation);
 }
Exemplo n.º 2
0
    public void addCamera(Camera camera, HUD hud)
    {
        SplitPair pair = new SplitPair(camera, hud);

        Canvas hudCanvas = hud.GetComponent <Canvas>();

        hudCanvas.worldCamera = camera;

        if (topLeft == null)
        {
            topLeft = pair;
        }
        else if (botLeft == null)
        {
            botLeft = pair;
            SetOrientation(topLeft, SplitHelper.Orientation.TOP);
            SetOrientation(botLeft, SplitHelper.Orientation.BOTTOM);
        }
        else if (topRight == null)
        {
            topRight = pair;
            SetOrientation(topLeft, SplitHelper.Orientation.TOP_LEFT);
            SetOrientation(topRight, SplitHelper.Orientation.TOP_RIGHT);
        }
        else if (botRight == null)
        {
            botRight = pair;
            SetOrientation(botLeft, SplitHelper.Orientation.BOT_LEFT);
            SetOrientation(botRight, SplitHelper.Orientation.BOT_RIGHT);
        }
        else
        {
            Debug.Log("WARNING: Too many cameras, SplitHelper only supports 4 cameras");
        }
    }
Exemplo n.º 3
0
    public void addCamera(Camera camera, HUD hud)
    {
        SplitPair pair = new SplitPair(camera, hud);

        Canvas hudCanvas = hud.GetComponent<Canvas>();
        hudCanvas.worldCamera = camera;

        if (topLeft == null) {
            topLeft = pair;
        } else if (botLeft == null) {
            botLeft = pair;
            SetOrientation(topLeft, SplitHelper.Orientation.TOP);
            SetOrientation(botLeft, SplitHelper.Orientation.BOTTOM);
        } else if (topRight == null) {
            topRight = pair;
            SetOrientation(topLeft, SplitHelper.Orientation.TOP_LEFT);
            SetOrientation(topRight, SplitHelper.Orientation.TOP_RIGHT);
        } else if (botRight == null) {
            botRight = pair;
            SetOrientation(botLeft, SplitHelper.Orientation.BOT_LEFT);
            SetOrientation(botRight, SplitHelper.Orientation.BOT_RIGHT);
        } else {
            Debug.Log("WARNING: Too many cameras, SplitHelper only supports 4 cameras");
        }
    }
Exemplo n.º 4
0
    private void SetOrientation(SplitPair pair, Orientation orientation)
    {
        switch (orientation)
        {
        case Orientation.CENTER:
            pair.camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
            break;

        case Orientation.LEFT:
            pair.camera.rect = new Rect(0.0f, 0.0f, 0.5f, 1.0f);
            break;

        case Orientation.RIGHT:
            pair.camera.rect = new Rect(0.5f, 0.0f, 0.5f, 1.0f);
            break;

        case Orientation.TOP:
            pair.camera.rect = new Rect(0.0f, 0.5f, 1.0f, 0.5f);
            break;

        case Orientation.BOTTOM:
            pair.camera.rect = new Rect(0.0f, 0.0f, 1.0f, 0.5f);
            break;

        case Orientation.TOP_LEFT:
            pair.camera.rect = new Rect(0.0f, 0.5f, 0.5f, 0.5f);
            break;

        case Orientation.TOP_RIGHT:
            pair.camera.rect = new Rect(0.5f, 0.5f, 0.5f, 0.5f);
            break;

        case Orientation.BOT_LEFT:
            pair.camera.rect = new Rect(0.0f, 0.0f, 0.5f, 0.5f);
            break;

        case Orientation.BOT_RIGHT:
            pair.camera.rect = new Rect(0.5f, 0.0f, 0.5f, 0.5f);
            break;
        }
        pair.hud.SetOrientation(orientation);
    }