override protected void Start()
        {
            base.Start();

            var positionAndSizeOverrider = ProCamera2D.gameObject.GetComponent<ProCamera2DPositionAndSizeOverrider>();
            _overridePosition = positionAndSizeOverrider == null ? ProCamera2D.gameObject.AddComponent<ProCamera2DPositionAndSizeOverrider>() : positionAndSizeOverrider;
            _overridePosition.hideFlags = HideFlags.HideInInspector;

            if (UseLetterbox)
                SetupLetterbox();

            _initialCameraSize = ProCamera2D.GameCameraSize;
        }
Beispiel #2
0
        override protected void Start()
        {
            base.Start();

            var positionAndSizeOverrider = ProCamera2D.gameObject.GetComponent <ProCamera2DPositionAndSizeOverrider>();

            _overridePosition = positionAndSizeOverrider == null?ProCamera2D.gameObject.AddComponent <ProCamera2DPositionAndSizeOverrider>() : positionAndSizeOverrider;

            _overridePosition.hideFlags = HideFlags.HideInInspector;

            if (UseLetterbox)
            {
                SetupLetterbox();
            }

            _initialCameraSize = ProCamera2D.GameCameraSize;
        }
        void Start()
        {
            if (ProCamera2D == null)
                return;

            if (PositionAndSizeOverrider == null)
            {
                var positionAndSizeOverrider = ProCamera2D.GetComponent<ProCamera2DPositionAndSizeOverrider>();
                PositionAndSizeOverrider = positionAndSizeOverrider == null ? ProCamera2D.gameObject.AddComponent<ProCamera2DPositionAndSizeOverrider>() : positionAndSizeOverrider;
                PositionAndSizeOverrider.hideFlags = HideFlags.HideInInspector;
            }

            if (NumericBoundaries == null)
            {
                var numericBoundaries = FindObjectOfType<ProCamera2DNumericBoundaries>();
                NumericBoundaries = numericBoundaries == null ? ProCamera2D.gameObject.AddComponent<ProCamera2DNumericBoundaries>() : numericBoundaries;
            }

            _boundsAnim = new BoundariesAnimator(ProCamera2D, NumericBoundaries);
            _boundsAnim.OnTransitionStarted += () =>
            {
                if (ProCamera2D.OnBoundariesTransitionStarted != null)
                    ProCamera2D.OnBoundariesTransitionStarted();
            };

            _boundsAnim.OnTransitionFinished += () =>
            {
                if (ProCamera2D.OnBoundariesTransitionFinished != null)
                    ProCamera2D.OnBoundariesTransitionFinished();
            };

            GetTargetBoundaries();

            if (SetAsStartingBoundaries)
                SetBoundaries();

            _initialCamSize = ProCamera2D.GameCameraSize;
        }
Beispiel #4
0
        protected override void Start()
        {
            base.Start();

            if (ProCamera2D == null)
            {
                return;
            }

            if (PositionAndSizeOverrider == null)
            {
                var positionAndSizeOverrider = ProCamera2D.GetComponent <ProCamera2DPositionAndSizeOverrider>();
                PositionAndSizeOverrider = positionAndSizeOverrider == null?ProCamera2D.gameObject.AddComponent <ProCamera2DPositionAndSizeOverrider>() : positionAndSizeOverrider;

                PositionAndSizeOverrider.hideFlags = HideFlags.HideInInspector;
            }

            if (NumericBoundaries == null)
            {
                var numericBoundaries = FindObjectOfType <ProCamera2DNumericBoundaries>();
                NumericBoundaries = numericBoundaries == null?ProCamera2D.gameObject.AddComponent <ProCamera2DNumericBoundaries>() : numericBoundaries;
            }

            _boundsAnim = new BoundariesAnimator(ProCamera2D, NumericBoundaries);
            _boundsAnim.OnTransitionStarted += () =>
            {
                if (ProCamera2D.OnBoundariesTransitionStarted != null)
                {
                    ProCamera2D.OnBoundariesTransitionStarted();
                }
            };

            _boundsAnim.OnTransitionFinished += () =>
            {
                if (ProCamera2D.OnBoundariesTransitionFinished != null)
                {
                    ProCamera2D.OnBoundariesTransitionFinished();
                }
            };

            GetTargetBoundaries();

            if (SetAsStartingBoundaries)
            {
                NumericBoundaries.CurrentBoundariesTriggerID = _instanceID;

                NumericBoundaries.UseLeftBoundary = UseLeftBoundary;
                if (UseLeftBoundary)
                {
                    NumericBoundaries.LeftBoundary = NumericBoundaries.TargetLeftBoundary = _targetLeftBoundary;
                }

                NumericBoundaries.UseRightBoundary = UseRightBoundary;
                if (UseRightBoundary)
                {
                    NumericBoundaries.RightBoundary = NumericBoundaries.TargetRightBoundary = _targetRightBoundary;
                }

                NumericBoundaries.UseTopBoundary = UseTopBoundary;
                if (UseTopBoundary)
                {
                    NumericBoundaries.TopBoundary = NumericBoundaries.TargetTopBoundary = _targetTopBoundary;
                }

                NumericBoundaries.UseBottomBoundary = UseBottomBoundary;
                if (UseBottomBoundary)
                {
                    NumericBoundaries.BottomBoundary = NumericBoundaries.TargetBottomBoundary = _targetBottomBoundary;
                }

                if (!UseTopBoundary && !UseBottomBoundary && !UseLeftBoundary && !UseRightBoundary)
                {
                    NumericBoundaries.UseNumericBoundaries = false;
                }
                else
                {
                    NumericBoundaries.UseNumericBoundaries = true;
                }
            }

            _initialCamSize = ProCamera2D.GameCameraSize;
        }
        protected override void Start()
        {
            base.Start();

            if (ProCamera2D == null)
                return;

            if (PositionAndSizeOverrider == null)
            {
                var positionAndSizeOverrider = ProCamera2D.gameObject.GetComponent<ProCamera2DPositionAndSizeOverrider>();
                PositionAndSizeOverrider = positionAndSizeOverrider == null ? ProCamera2D.gameObject.AddComponent<ProCamera2DPositionAndSizeOverrider>() : positionAndSizeOverrider;
                PositionAndSizeOverrider.hideFlags = HideFlags.HideInInspector;
                PositionAndSizeOverrider.enabled = false;
            }
            PositionAndSizeOverrider.enabled = false;

            if (NumericBoundaries == null)
            {
                var numericBoundaries = ProCamera2D.gameObject.GetComponent<ProCamera2DNumericBoundaries>();
                NumericBoundaries = numericBoundaries == null ? ProCamera2D.gameObject.AddComponent<ProCamera2DNumericBoundaries>() : numericBoundaries;
            }

            _boundsAnim = new BoundariesAnimator(ProCamera2D, NumericBoundaries);
            _boundsAnim.OnTransitionStarted += () =>
            {
                if (ProCamera2D.OnBoundariesTransitionStarted != null)
                    ProCamera2D.OnBoundariesTransitionStarted();
            };

            _boundsAnim.OnTransitionFinished += () =>
            {
                if (ProCamera2D.OnBoundariesTransitionFinished != null)
                    ProCamera2D.OnBoundariesTransitionFinished();
            };

            GetTargetBoundaries();

            if (SetAsStartingBoundaries)
            {
                NumericBoundaries.CurrentBoundariesTriggerID = _instanceID;

                NumericBoundaries.UseLeftBoundary = UseLeftBoundary;
                if (UseLeftBoundary)
                    NumericBoundaries.LeftBoundary = NumericBoundaries.TargetLeftBoundary = _targetLeftBoundary;

                NumericBoundaries.UseRightBoundary = UseRightBoundary;
                if (UseRightBoundary)
                    NumericBoundaries.RightBoundary = NumericBoundaries.TargetRightBoundary = _targetRightBoundary;

                NumericBoundaries.UseTopBoundary = UseTopBoundary;
                if (UseTopBoundary)
                    NumericBoundaries.TopBoundary = NumericBoundaries.TargetTopBoundary = _targetTopBoundary;

                NumericBoundaries.UseBottomBoundary = UseBottomBoundary;
                if (UseBottomBoundary)
                    NumericBoundaries.BottomBoundary = NumericBoundaries.TargetBottomBoundary = _targetBottomBoundary;

                if (!UseTopBoundary && !UseBottomBoundary && !UseLeftBoundary && !UseRightBoundary)
                    NumericBoundaries.UseNumericBoundaries = false;
                else
                    NumericBoundaries.UseNumericBoundaries = true;
            }

            _initialCamSize = ProCamera2D.GameCameraSize;
        }
        void Awake()
        {
            if (PositionAndSizeOverrider == null)
            {
                var positionAndSizeOverrider = ProCamera2D.gameObject.GetComponent<ProCamera2DPositionAndSizeOverrider>();
                PositionAndSizeOverrider = positionAndSizeOverrider == null ? ProCamera2D.gameObject.AddComponent<ProCamera2DPositionAndSizeOverrider>() : positionAndSizeOverrider;
                PositionAndSizeOverrider.hideFlags = HideFlags.HideInInspector;
                PositionAndSizeOverrider.enabled = false;
            }

            PositionAndSizeOverrider.enabled = false;

            if (NumericBoundaries == null)
            {
                var numericBoundaries = ProCamera2D.gameObject.GetComponent<ProCamera2DNumericBoundaries>();
                NumericBoundaries = numericBoundaries == null ? ProCamera2D.gameObject.AddComponent<ProCamera2DNumericBoundaries>() : numericBoundaries;
            }
        }