Esempio n. 1
0
 /// <summary>
 /// returns where new path with specified units can move out of the way after specified path makes it
 /// </summary>
 /// <remarks>chooses a random location between makePathMinDist() and makePathMaxDist() away from path</remarks>
 private FP.Vector makePathMovePos(long time, Path path, List<Unit> units)
 {
     long makePathMinDist = path.makePathMinDist (time, units);
     long makePathMaxDist = path.makePathMaxDist (time, units);
     FP.Vector ret;
     do {
         ret = new FP.Vector((long)((UnityEngine.Random.value - 0.5) * makePathMaxDist * 2),
             (long)((UnityEngine.Random.value - 0.5) * makePathMaxDist * 2));
     } while (ret.lengthSq() < makePathMinDist * makePathMinDist
         || ret.lengthSq() > makePathMaxDist * makePathMaxDist);
     return ret + path.posWhen(time);
 }