public static void FleeHurtDir(BaseContext c)
 {
     if (c.AIAgent.IsNavRunning() && NavigateToOperator.NavigateInDirOfBestSample(c, NavPointSampler.SampleCount.Eight, 4f, NavPointSampler.SampleFeatures.RetreatFromDirection, c.AIAgent.GetStats.MinFleeRange, c.AIAgent.GetStats.MaxFleeRange))
     {
         c.SetFact(BaseNpc.Facts.IsFleeing, 1);
     }
 }
示例#2
0
 public static void FleeEnemy(BaseContext c)
 {
     if (!c.AIAgent.IsNavRunning() || !NavigateToOperator.NavigateInDirOfBestSample(c, NavPointSampler.SampleCount.Eight, 4f, NavPointSampler.SampleFeatures.RetreatFromTarget, c.AIAgent.GetStats.MinFleeRange, c.AIAgent.GetStats.MaxFleeRange))
     {
         return;
     }
     c.SetFact(BaseNpc.Facts.IsFleeing, (byte)1);
 }
 public static void NavigateToTopologyPreference(BaseContext c)
 {
     if (IsRoamReady.Evaluate(c) && c.AIAgent.IsNavRunning())
     {
         if (NavigateToOperator.NavigateInDirOfBestSample(c, NavPointSampler.SampleCount.Eight, 4f, NavPointSampler.SampleFeatures.DiscourageSharpTurns | NavPointSampler.SampleFeatures.TopologyPreference | NavPointSampler.SampleFeatures.RangeFromSpawn, c.AIAgent.GetStats.MinRoamRange, c.AIAgent.GetStats.MaxRoamRange))
         {
             float maxRoamDelay = c.AIAgent.GetStats.MaxRoamDelay - c.AIAgent.GetStats.MinRoamDelay;
             float single       = UnityEngine.Random.@value * maxRoamDelay / maxRoamDelay;
             float single1      = c.AIAgent.GetStats.RoamDelayDistribution.Evaluate(single) * maxRoamDelay;
             c.NextRoamTime = Time.realtimeSinceStartup + c.AIAgent.GetStats.MinRoamDelay + single1;
             return;
         }
         NavigateToOperator.NavigateToRandomLoc(c);
     }
 }
示例#4
0
 public static void NavigateToRandomLoc(BaseContext c)
 {
     if (!IsRoamReady.Evaluate(c) || !c.AIAgent.IsNavRunning())
     {
         return;
     }
     if (NavigateToOperator.NavigateInDirOfBestSample(c, NavPointSampler.SampleCount.Eight, 4f, NavPointSampler.SampleFeatures.DiscourageSharpTurns | NavPointSampler.SampleFeatures.RangeFromSpawn, c.AIAgent.GetStats.MinRoamRange, c.AIAgent.GetStats.MaxRoamRange))
     {
         float num1 = c.AIAgent.GetStats.MaxRoamDelay - c.AIAgent.GetStats.MinRoamDelay;
         float num2 = Random.get_value() * num1 / num1;
         float num3 = c.AIAgent.GetStats.RoamDelayDistribution.Evaluate(num2) * num1;
         c.NextRoamTime = Time.get_realtimeSinceStartup() + c.AIAgent.GetStats.MinRoamDelay + num3;
     }
     else
     {
         NavigateToOperator.NavigateToSpawn(c);
     }
 }