Exemplo n.º 1
0
        public static void ApplyCurvature(float curvature)
        {
            HB hb = HB.Instance;

            if (hb == null)
            {
                return;
            }
            hb.Curvature = curvature;
            HBUtils.HBCurvature(curvature * CURVATURE_FACTOR);
        }
Exemplo n.º 2
0
        private void Update()
        {
            if (Application.isPlaying)
            {
                return;
            }

            bool positionChanged = false;

            if (m_previosPosition != transform.position)
            {
                positionChanged   = !AttachToCamera;
                m_previosPosition = transform.position;
            }

            if (RaycastStride < 0.01f)
            {
                RaycastStride = 0.01f;
            }

            if (m_previousRadius != FixBoundsRadius)
            {
                if (FixBoundsRadius < 0)
                {
                    FixBoundsRadius = 0;
                }

                m_previousRadius = FixBoundsRadius;
            }
            if (m_previousCurvature != Curvature)
            {
                HBUtils.HBCurvature(Curvature * CURVATURE_FACTOR);
                m_previousCurvature = Curvature;
            }

            if (m_previousFlatten != Flatten)
            {
                if (Flatten < 0)
                {
                    Flatten = 0;
                }
                HBUtils.HBFlatten(Flatten);
                m_previousFlatten = Flatten;
            }

            if (m_previousHorizonZOffset != HorizonZOffset || m_previousHorizonYOffset != HorizonYOffset || m_previousHorizonXOffset != HorizonXOffset || positionChanged)
            {
                if (AttachToCamera)
                {
                    HBUtils.HBHorizonOffset(HorizonXOffset, HorizonYOffset, HorizonZOffset);
                }
                else
                {
                    HBUtils.HBHorizonOffset(HorizonXOffset, HorizonYOffset, HorizonZOffset, transform);
                }

                m_previousHorizonZOffset = HorizonZOffset;
                m_previousHorizonYOffset = HorizonYOffset;
                m_previousHorizonXOffset = HorizonXOffset;
            }

            if (m_previousMode != BendingMode)
            {
                HBUtils.HBMode(BendingMode);
                m_previousMode = BendingMode;
            }

            if (m_prevCameraTracking != AttachToCamera)
            {
                if (AttachToCamera)
                {
                    HBUtils.HBHorizonOffset(HorizonXOffset, HorizonYOffset, HorizonZOffset);
                }
                else
                {
                    HBUtils.HBHorizonOffset(HorizonXOffset, HorizonYOffset, HorizonZOffset, transform);
                }

                m_prevCameraTracking = AttachToCamera;
            }
        }