Пример #1
0
        public void SetCameraRect()
        {
            if (SetAspectRatio() && Application.isPlaying)
            {
                CreateBorderCamera();
            }

            if (isSplitScreen)
            {
                _camera.rect = GetSplitScreenRect(true);
            }
            else
            {
                if (borderOrientation == MenuOrientation.Vertical)
                {
                    _camera.rect = new Rect(borderWidth, 0f, 1f - (2 * borderWidth), 1f);
                }
                else if (borderOrientation == MenuOrientation.Horizontal)
                {
                    _camera.rect = new Rect(0f, borderWidth, 1f, 1f - (2 * borderWidth));
                }
            }

            BackgroundCamera backgroundCamera = FindObjectOfType(typeof(BackgroundCamera)) as BackgroundCamera;

            if (backgroundCamera)
            {
                backgroundCamera.UpdateRect();
            }
        }
Пример #2
0
 /**
  * <summary>Registers a BackgroundCamera, so that it can be updated</summary>
  * <param name = "_object">The BackgroundCamera to register</param>
  */
 public void Register(BackgroundCamera _object)
 {
     if (!backgroundCameras.Contains(_object))
     {
         backgroundCameras.Add(_object);
         _object.UpdateRect();
     }
 }