Exemple #1
0
 public static void GetRandomPathForCsWander(PeEntity npc, Vector3 center, Vector3 direction, float minRadius, float maxRadius, OnPathDelegate callback = null)
 {
     if (AstarPath.active != null)
     {
         Pathfinding.RandomPath path = Pathfinding.RandomPath.Construct(npc.position, (int)Random.Range(minRadius, maxRadius) * 100, callback);
         path.spread      = 40000;
         path.aimStrength = 1f;
         path.aim         = PETools.PEUtil.GetRandomPosition(npc.position, direction, minRadius, maxRadius, -75.0f, 75.0f);
         AstarPath.StartPath(path);
         return;
     }
     return;
 }
Exemple #2
0
        Vector3 GetPatrolPosition(Vector3 center, Vector3 direction, float minRadius, float maxRadius)
        {
            if (AstarPath.active != null)            //PEUtil.IsInAstarGrid(position))
            {
                Pathfinding.RandomPath path = Pathfinding.RandomPath.Construct(position, (int)Random.Range(minRadius, maxRadius) * 100, OnPathComplete);
                path.spread      = 40000;
                path.aimStrength = 1f;
                path.aim         = PEUtil.GetRandomPosition(position, direction, minRadius, maxRadius, -75.0f, 75.0f);
                AstarPath.StartPath(path);

                return(Vector3.zero);
            }
            return(Vector3.zero);
        }