示例#1
0
 public bool IsWalkable()
 {
     if (g_Up != null)
     {
         Ray        ray = new Ray(g_Position, g_Up);
         RaycastHit hit;
         Available = !(Physics.Raycast(Position, Up, out hit, g_BlockingHeight) ||
                       Physics.Raycast(Position + new Vector3(Radius, 0, 0), Up, g_BlockingHeight) ||
                       Physics.Raycast(Position + new Vector3(-Radius, 0, 0), Up, g_BlockingHeight) ||
                       Physics.Raycast(Position + new Vector3(0, 0, Radius), Up, g_BlockingHeight) ||
                       Physics.Raycast(Position + new Vector3(0, 0, -Radius), Up, g_BlockingHeight));
         if (hit.collider)
         {
             INPCPathfinder[] finder = hit.collider.GetComponents <INPCPathfinder>();
             foreach (INPCPathfinder ipf in finder)
             {
                 g_Grid.AddINPCPathfinderNode(ipf, this);
             }
         }
         return(Available);
     }
     else
     {
         return(true);
     }
 }