Exemplo n.º 1
0
 private void OnDrawGizmos()
 {
     if (m_Calculate && m_Target)
     {
         m_Calculate = false;
         NavMesh.CalculatePath(transform.position, m_Target.position, 1, mPath);
         mAgent.SetDestination(m_Target.position);
     }
     if (mAgent)
     {
         mPath = mAgent.path;
     }
     if (mPath != null)
     {
         Vector3[] ps = mPath.corners;
         Gizmos.color = Color.cyan;
         for (int i = 1; i < ps.Length; i++)
         {
             Gizmos.DrawLine(ps[i - 1], ps[i]);
             GizmosUtil.MarkInScene(ps[i], 20, 0);
         }
     }
     if (mAgent)
     {
         Gizmos.color = Color.green;
         GizmosUtil.MarkInScene(mAgent.nextPosition, 30, 0);
     }
 }