void OnBecameVisible()
        {
            m_vectorLine.active = true;

            // Draw line now, otherwise's there's a 1-frame delay before the line is actually drawn in the next LateUpdate
            VectorManager.DrawArrayLine(m_objectNumber.i);
        }
示例#2
0
        private void LateUpdate()
        {
            if (!VectorLine.camTransformExists)
            {
                return;
            }

            // Draw3DAuto lines
            for (int i = 0; i < lineCount; i++)
            {
                if (lines[i].rectTransform != null)
                {
                    lines[i].Draw3D();
                }
                else
                {
                    RemoveLine(i--);
                }
            }

            // Only redraw static objects if camera is moving
            if (VectorLine.CameraHasMoved())
            {
                VectorManager.DrawArrayLines();
            }

            VectorLine.UpdateCameraInfo();

            // Always redraw dynamic objects
            VectorManager.DrawArrayLines2();
        }
示例#3
0
 // Force the color to be set when becoming visible
 void OnBecameVisible()
 {
     VectorManager.SetOldDistance(m_objectNumber.i, -1);
     VectorManager.SetDistanceColor(m_objectNumber.i);
     if (!m_useLine)
     {
         return;
     }
     m_vectorLine.active = true;
 }
示例#4
0
 public void Setup(VectorLine line, bool m_useLine)
 {
     m_objectNumber = new RefInt(0);
     VectorManager.CheckDistanceSetup(transform, line, line.color, m_objectNumber);
     VectorManager.SetDistanceColor(m_objectNumber.i);
     if (m_useLine)              // Only if there are no Visibility scripts being used
     {
         this.m_useLine = true;
         m_vectorLine   = line;
     }
 }
示例#5
0
        public void Setup(VectorLine line, bool makeBounds)
        {
            if (makeBounds)
            {
                VectorManager.SetupBoundsMesh(gameObject, line);
            }

            VectorManager.VisibilitySetup(transform, line, out m_objectNumber);
            m_vectorLine = line;
            VectorManager.DrawArrayLine2(m_objectNumber.i);
            StartCoroutine(VisibilityTest());
        }
示例#6
0
 void OnDestroy()
 {
     if (m_destroyed)
     {
         return;                         // Paranoia check
     }
     m_destroyed = true;
     VectorManager.DistanceRemove(m_objectNumber.i);
     if (m_useLine)
     {
         VectorLine.Destroy(ref m_vectorLine);
     }
 }
 void OnDestroy()
 {
     if (m_destroyed)
     {
         return;                         // Paranoia check
     }
     m_destroyed = true;
     VectorManager.VisibilityStaticRemove(m_objectNumber.i);
     if (m_dontDestroyLine)
     {
         return;
     }
     VectorLine.Destroy(ref m_vectorLine);
 }
        IEnumerator WaitCheck()
        {
            // Ensure that the line is drawn once even if the camera isn't moving
            // Otherwise this object would be invisible until the camera moves
            // However, the camera might not have been set up yet, so wait a frame and turn off if necessary
            VectorManager.DrawArrayLine(m_objectNumber.i);

            yield return(null);

            if (!GetComponent <Renderer>().isVisible)
            {
                m_vectorLine.active = false;
            }
        }
        public void Setup(VectorLine line, bool makeBounds)
        {
            if (makeBounds)
            {
                VectorManager.SetupBoundsMesh(gameObject, line);
            }
            // Adjust points to this position, so the line doesn't have to be updated with the transform of this object
            // Also make sure the points are unique by creating a new list and copying the points over
            m_originalMatrix = transform.localToWorldMatrix;
            var thisPoints = new List <Vector3>(line.points3);

            for (int i = 0; i < thisPoints.Count; i++)
            {
                thisPoints[i] = m_originalMatrix.MultiplyPoint3x4(thisPoints[i]);
            }
            line.points3 = thisPoints;
            m_vectorLine = line;

            VectorManager.VisibilityStaticSetup(line, out m_objectNumber);
            StartCoroutine(WaitCheck());
        }
示例#10
0
 private void CheckDistance()
 {
     VectorManager.CheckDistance();
 }
示例#11
0
 public void Setup(VectorLine line)
 {
     VectorManager.VisibilitySetup(transform, line, out m_objectNumber);
     VectorManager.DrawArrayLine2(m_objectNumber.i);
     m_vectorLine = line;
 }