FindClosestEdge() private method

private FindClosestEdge ( NavMeshHit &hit ) : bool
hit NavMeshHit
return bool
コード例 #1
0
 static public int FindClosestEdge(IntPtr l)
 {
     try {
         UnityEngine.AI.NavMeshAgent self = (UnityEngine.AI.NavMeshAgent)checkSelf(l);
         UnityEngine.AI.NavMeshHit   a1;
         var ret = self.FindClosestEdge(out a1);
         pushValue(l, true);
         pushValue(l, ret);
         pushValue(l, a1);
         return(3);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #2
0
 static int FindClosestEdge(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.AI.NavMeshAgent obj = (UnityEngine.AI.NavMeshAgent)ToLua.CheckObject(L, 1, typeof(UnityEngine.AI.NavMeshAgent));
         UnityEngine.AI.NavMeshHit   arg0;
         bool o = obj.FindClosestEdge(out arg0);
         LuaDLL.lua_pushboolean(L, o);
         ToLua.PushValue(L, arg0);
         return(2);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #3
0
        private void fixThoseOutsideNavmesh()
        {
            if (_agent.FindClosestEdge(out hitNav))
            {
                if ((!float.IsInfinity(hitNav.position.x) && !float.IsNegativeInfinity(hitNav.position.x)) &&
                    (!float.IsInfinity(hitNav.position.y) && !float.IsNegativeInfinity(hitNav.position.y)) &&
                    (!float.IsInfinity(hitNav.position.z) && !float.IsNegativeInfinity(hitNav.position.z)))
                {
                    transform.position = Vector3.MoveTowards(transform.position, hitNav.position, 0.02f * Time.deltaTime);
                    transform.position = hitNav.position;
                    _agent.SetDestination(parent.target);
//Debug.DrawLine(transform.position, transform.position + Vector3.up * 50, Color.grey);
                    if (indexListaCorrigidos < 5)
                    {
                        listaPontosCorrigidos[indexListaCorrigidos] = hitNav.position;
                    }
                    indexListaCorrigidos++;
                    if (indexListaCorrigidos == 5)
                    {
                        bool bTodosiguais = true;
                        foreach (Vector3 p in listaPontosCorrigidos)
                        {
                            if (p != listaPontosCorrigidos[0])
                            {
                                bTodosiguais = false;
                            }
                        }
                        if (bTodosiguais)
                        {
                            locomotionMode = LocomotionMode.OUTSIDE_NAVMESH;//Se o GajoCitizen.FixedUpdate detectar isto remove o caracter
                        }
                    }
                }
            }
            if (indexListaCorrigidos > 5)
            {
                indexListaCorrigidos = 0;
            }
        }