public void OnCameraBoundEntry(CameraBound cameraBound)
        {
            ARKLogger.LogMessage(eLogCategory.Control,
                                 eLogLevel.Info,
                                 "OnCameraBoundEntry");

            foreach(AbstractCamera cam in registeredCameras)
            {
                if (cameraBound.GetComponent<Renderer>().IsVisibleFrom(cam.GetComponent<Camera>()))
                {
                    CameraMovementRestrictions restriction = new CameraMovementRestrictions();
                    Vector3 viewPos = cam.GetComponent<Camera>().WorldToViewportPoint(cameraBound.transform.position);
                    DetermineRestriction(viewPos.x, cameraBound.onXEntry, ref restriction.xAxis);
                    DetermineRestriction(viewPos.y, cameraBound.onYEntry, ref restriction.yAxis);
                    cam.RegisterBound(cam.GetInstanceID(), restriction);
                }
            }
        }
Ejemplo n.º 2
0
        public static CameraMovementRestrictions operator +(CameraMovementRestrictions r1, CameraMovementRestrictions r2)
        {
            CameraMovementRestrictions result = new CameraMovementRestrictions();

            if (r1.xAxis == eAxisRestriction.AxisRestrictionNone)
            {
                result.xAxis = r2.xAxis;
            }
            else if (((r1.xAxis == eAxisRestriction.AxisRestrictionNegative) && (r2.xAxis == eAxisRestriction.AxisRestrictionPositive)) ||
                     ((r1.xAxis == eAxisRestriction.AxisRestrictionPositive) && (r2.xAxis == eAxisRestriction.AxisRestrictionNegative)) ||
                      (r2.xAxis == eAxisRestriction.AxisRestrictionBoth))
            {
                result.xAxis = eAxisRestriction.AxisRestrictionBoth;
            }

            if (r1.yAxis == eAxisRestriction.AxisRestrictionNone)
            {
                result.yAxis = r2.yAxis;
            }
            else if (((r1.yAxis == eAxisRestriction.AxisRestrictionNegative) && (r2.yAxis == eAxisRestriction.AxisRestrictionPositive)) ||
                     ((r1.yAxis == eAxisRestriction.AxisRestrictionPositive) && (r2.yAxis == eAxisRestriction.AxisRestrictionNegative)) ||
                      (r2.yAxis == eAxisRestriction.AxisRestrictionBoth))
            {
                result.yAxis = eAxisRestriction.AxisRestrictionBoth;
            }

            if (r1.zAxis == eAxisRestriction.AxisRestrictionNone)
            {
                result.zAxis = r2.zAxis;
            }
            else if (((r1.zAxis == eAxisRestriction.AxisRestrictionNegative) && (r2.zAxis == eAxisRestriction.AxisRestrictionPositive)) ||
                     ((r1.zAxis == eAxisRestriction.AxisRestrictionPositive) && (r2.zAxis == eAxisRestriction.AxisRestrictionNegative)) ||
                      (r2.zAxis == eAxisRestriction.AxisRestrictionBoth))
            {
                result.zAxis = eAxisRestriction.AxisRestrictionBoth;
            }

            return result;
        }
Ejemplo n.º 3
0
        public virtual void UpdateMovementRestrictions()
        {
            CameraMovementRestrictions newRestriction = new CameraMovementRestrictions();

            if (0 == restrictionList.Count)
            {
                restrictions.xAxis = eAxisRestriction.AxisRestrictionNone;
                restrictions.yAxis = eAxisRestriction.AxisRestrictionNone;
                restrictions.zAxis = eAxisRestriction.AxisRestrictionNone;
            }
            else
            {
                foreach (KeyValuePair<int, CameraMovementRestrictions> entry in restrictionList)
                {
                    newRestriction += entry.Value;
                }
            }
            restrictions = newRestriction;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Axis the movement should be constrained.
        /// </summary>
        public virtual void RegisterBound(int id, CameraMovementRestrictions restriction)
        {
            CameraMovementRestrictions dummy;

            if ( false == restrictionList.TryGetValue(id, out dummy))
            {
                restrictionList.Add(id, restriction);
            }
            else
            {
                restrictionList.Remove(id);
                restrictionList.Add(id, restriction);
            }
        }