private static bool EvaluateFlanking( CoverContext c, CoverPoint option, Vector3 dirCover, Vector3 dirDanger, float directness, out float result) { result = 0.0f; if ((double)directness > -0.5 && (double)directness < 0.5) { float num = 1f - Mathf.Abs(directness); if ((double)num > (double)c.BestFlankValue) { if (ConVar.AI.npc_cover_use_path_distance && c.Self.IsNavRunning() && Object.op_Inequality((Object)c.Self.AttackTarget, (Object)null)) { NPCPlayerApex self = c.Self as NPCPlayerApex; if (Object.op_Inequality((Object)self, (Object)null) && !self.PathDistanceIsValid(c.Self.AttackTarget.ServerPosition, option.Position, false)) { return(false); } } c.BestFlankValue = 0.1f - Mathf.Abs(num); c.BestFlankCP = option; result = c.BestFlankValue; return(true); } } return(false); }
private static bool EvaluateRetreat( CoverContext c, CoverPoint option, Vector3 dirCover, Vector3 dirDanger, ref float directness, out float result) { result = 0.0f; if ((double)directness <= -0.5) { NPCPlayerApex self = c.Self as NPCPlayerApex; if (Object.op_Equality((Object)self, (Object)null)) { return(false); } if ((double)((Vector3) ref dirCover).get_sqrMagnitude() < (double)self.MinDistanceToRetreatCover * (double)self.MinDistanceToRetreatCover) { directness = -0.49f; return(false); } float num = directness * -1f; if ((double)num > (double)c.BestRetreatValue) { c.BestRetreatValue = num; c.BestRetreatCP = option; result = c.BestRetreatValue; return(true); } } return(false); }
public static bool Evaluate( CoverContext context, IList <IOptionScorer <CoverPoint> > scorers, List <CoverPoint> options, int numOptions, bool allScorersMustScoreAboveZero) { for (int index1 = 0; index1 < numOptions; ++index1) { float num1 = 0.0f; for (int index2 = 0; index2 < ((ICollection <IOptionScorer <CoverPoint> >)scorers).Count; ++index2) { if (!((ICanBeDisabled)scorers[index2]).get_isDisabled()) { float num2 = scorers[index2].Score((IAIContext)context, options[index1]); if (!allScorersMustScoreAboveZero || (double)num2 > 0.0) { num1 += num2; } else { break; } } } } if (context.BestAdvanceCP == null && context.BestFlankCP == null) { return(context.BestRetreatCP != null); } return(true); }
public static float Evaluate(CoverContext c, CoverPoint option, float arcThreshold) { float single; if (c != null) { if (option.IsReserved || option.IsCompromised) { return(0f); } Vector3 serverPosition = c.Self.Entity.ServerPosition; if (option.ProvidesCoverFromPoint(c.DangerPoint, arcThreshold)) { Vector3 position = option.Position - serverPosition; Vector3 dangerPoint = c.DangerPoint - serverPosition; float single1 = Vector3.Dot(position.normalized, dangerPoint.normalized); if (CoverScorer.EvaluateAdvancement(c, option, position, dangerPoint, single1, out single)) { return(single); } if (CoverScorer.EvaluateRetreat(c, option, position, dangerPoint, ref single1, out single)) { return(single); } if (CoverScorer.EvaluateFlanking(c, option, position, dangerPoint, single1, out single)) { return(single); } } } return(0f); }
private static bool EvaluateRetreat(CoverContext c, CoverPoint option, Vector3 dirCover, Vector3 dirDanger, ref float directness, out float result) { result = 0f; if (directness <= -0.5f) { NPCPlayerApex self = c.Self as NPCPlayerApex; if (self == null) { return(false); } if (dirCover.sqrMagnitude < self.MinDistanceToRetreatCover * self.MinDistanceToRetreatCover) { directness = -0.49f; return(false); } float single = directness * -1f; if (single > c.BestRetreatValue) { c.BestRetreatValue = single; c.BestRetreatCP = option; result = c.BestRetreatValue; return(true); } } return(false); }
public override void Execute(IAIContext context) { CoverContext coverContext = context as CoverContext; if (coverContext != null) { SelectCoverPoint.Evaluate(coverContext, base.scorers, coverContext.SampledCoverPoints, coverContext.SampledCoverPoints.Count, this.allScorersMustScoreAboveZero); } }
public virtual void Execute(IAIContext context) { CoverContext context1 = context as CoverContext; if (context1 == null) { return; } SelectCoverPoint.Evaluate(context1, this.get_scorers(), context1.SampledCoverPoints, context1.SampledCoverPoints.Count, this.allScorersMustScoreAboveZero); }
public static float Evaluate(CoverContext c, CoverPoint option, float arcThreshold, float maxRange) { if (c == null || !option.ProvidesCoverFromPoint(c.Self.Entity.ServerPosition, arcThreshold)) { return(0f); } float position = (option.Position - c.DangerPoint).sqrMagnitude; float single = maxRange * maxRange; return(1f - Mathf.Min(position, single) / single); }
public static float Evaluate(CoverContext c, CoverPoint option) { if (c != null) { NPCPlayerApex entity = c.Self.Entity as NPCPlayerApex; if (entity != null && !entity.AiContext.HasCheckedHideout(option)) { return(1f); } } return(0f); }
public static float Evaluate(CoverContext c, CoverPoint option) { if (c != null) { NPCPlayerApex entity = c.Self.Entity as NPCPlayerApex; if (Object.op_Inequality((Object)entity, (Object)null) && !entity.AiContext.HasCheckedHideout(option)) { return(1f); } } return(0.0f); }
public static float Evaluate(CoverContext c, CoverPoint option) { if (c == null) { return(0.0f); } Vector3 serverPosition = c.Self.Entity.ServerPosition; Vector3 vector3_1 = Vector3.op_Subtraction(c.DangerPoint, serverPosition); double magnitude1 = (double)((Vector3) ref vector3_1).get_magnitude(); Vector3 vector3_2 = Vector3.op_Subtraction(option.Position, serverPosition); double magnitude2 = (double)((Vector3) ref vector3_2).get_magnitude(); return((double)Mathf.Abs((float)(magnitude1 - magnitude2)) > 8.0 ? 0.0f : 1f); }
public static bool Evaluate(CoverContext c, CoverPoint option) { if (c == null || c.Self.AttackTarget == null) { return(false); } NPCPlayerApex entity = c.Self.Entity as NPCPlayerApex; if (entity == null) { return(false); } return(entity.PathDistanceIsValid(option.Position, c.DangerPoint, true)); }
public static float Evaluate(CoverContext c, CoverPoint option) { if (c == null) { return(0f); } Vector3 serverPosition = c.Self.Entity.ServerPosition; if (Mathf.Abs((c.DangerPoint - serverPosition).magnitude - (option.Position - serverPosition).magnitude) > 8f) { return(0f); } return(1f); }
public static float Evaluate(CoverContext c, CoverPoint option) { if (c != null) { Vector3 serverPosition = c.Self.Entity.ServerPosition; Vector3 dangerPoint = c.DangerPoint - serverPosition; Vector3 vector3 = dangerPoint.normalized; dangerPoint = option.Position - serverPosition; float single = Vector3.Dot(dangerPoint.normalized, vector3); if (single > 0.5f) { return(single); } } return(0f); }
public static float Evaluate(CoverContext c, CoverPoint option) { if (c != null) { Vector3 serverPosition = c.Self.Entity.ServerPosition; Vector3 vector3_1 = Vector3.op_Subtraction(c.DangerPoint, serverPosition); Vector3 normalized = ((Vector3) ref vector3_1).get_normalized(); Vector3 vector3_2 = Vector3.op_Subtraction(option.Position, serverPosition); float num = Vector3.Dot(((Vector3) ref vector3_2).get_normalized(), normalized); if ((double)num > 0.5) { return(num); } } return(0.0f); }
public static bool Evaluate( CoverContext context, IList <IOptionScorer <CoverPoint> > scorers, List <CoverPoint> options, int numOptions, bool allScorersMustScoreAboveZero) { for (int index1 = 0; index1 < numOptions; ++index1) { float num1 = 0.0f; for (int index2 = 0; index2 < ((ICollection <IOptionScorer <CoverPoint> >)scorers).Count; ++index2) { if (!((ICanBeDisabled)scorers[index2]).get_isDisabled()) { float num2 = scorers[index2].Score((IAIContext)context, options[index1]); if (!allScorersMustScoreAboveZero || (double)num2 > 0.0) { num1 += num2; } else { break; } } } if ((double)num1 > (double)context.HideoutValue) { context.HideoutCP = options[index1]; } } if (context.HideoutCP == null) { return(false); } NPCPlayerApex entity = context.Self.Entity as NPCPlayerApex; if (Object.op_Inequality((Object)entity, (Object)null)) { entity.AiContext.CheckedHideoutPoints.Add(new NPCHumanContext.HideoutPoint() { Hideout = context.HideoutCP, Time = Time.get_time() }); } return(true); }
private static bool EvaluateAdvancement( CoverContext c, CoverPoint option, Vector3 dirCover, Vector3 dirDanger, float directness, out float result) { result = 0.0f; if ((double)directness > 0.5 && (double)((Vector3) ref dirCover).get_sqrMagnitude() > (double)((Vector3) ref dirDanger).get_sqrMagnitude() || (double)directness < 0.5) { return(false); } float sqrMagnitude = ((Vector3) ref dirCover).get_sqrMagnitude(); if ((double)sqrMagnitude > (double)((Vector3) ref dirDanger).get_sqrMagnitude()) { return(false); } float num = directness; if ((double)num <= (double)c.BestAdvanceValue) { return(false); } if (ConVar.AI.npc_cover_use_path_distance && c.Self.IsNavRunning() && Object.op_Inequality((Object)c.Self.AttackTarget, (Object)null)) { NPCPlayerApex self = c.Self as NPCPlayerApex; if (Object.op_Inequality((Object)self, (Object)null) && !self.PathDistanceIsValid(c.Self.AttackTarget.ServerPosition, option.Position, false)) { return(false); } } Vector3 vector3 = Vector3.op_Subtraction(option.Position, c.DangerPoint); if ((double)((Vector3) ref vector3).get_sqrMagnitude() < (double)sqrMagnitude) { num *= 0.9f; } c.BestAdvanceValue = num; c.BestAdvanceCP = option; result = c.BestAdvanceValue; return(true); }
public static float Evaluate(CoverContext c, CoverPoint option, float arcThreshold) { if (c != null && !option.IsReserved && !option.IsCompromised) { Vector3 serverPosition = c.Self.Entity.ServerPosition; if (option.ProvidesCoverFromPoint(c.DangerPoint, arcThreshold)) { Vector3 dirCover = Vector3.op_Subtraction(option.Position, serverPosition); Vector3 dirDanger = Vector3.op_Subtraction(c.DangerPoint, serverPosition); float directness = Vector3.Dot(((Vector3) ref dirCover).get_normalized(), ((Vector3) ref dirDanger).get_normalized()); float result; if (CoverScorer.EvaluateAdvancement(c, option, dirCover, dirDanger, directness, out result) || CoverScorer.EvaluateRetreat(c, option, dirCover, dirDanger, ref directness, out result) || CoverScorer.EvaluateFlanking(c, option, dirCover, dirDanger, directness, out result)) { return(result); } } } return(0.0f); }
public static bool Evaluate(CoverContext context, IList <IOptionScorer <CoverPoint> > scorers, List <CoverPoint> options, int numOptions, bool allScorersMustScoreAboveZero) { for (int i = 0; i < numOptions; i++) { float single = 0f; for (int j = 0; j < scorers.Count; j++) { if (!scorers[j].isDisabled) { float single1 = scorers[j].Score(context, options[i]); if (allScorersMustScoreAboveZero && single1 <= 0f) { break; } single += single1; } } if (single > context.HideoutValue) { context.HideoutCP = options[i]; } } if (context.HideoutCP == null) { return(false); } NPCPlayerApex entity = context.Self.Entity as NPCPlayerApex; if (entity != null) { List <NPCHumanContext.HideoutPoint> checkedHideoutPoints = entity.AiContext.CheckedHideoutPoints; NPCHumanContext.HideoutPoint hideoutPoint = new NPCHumanContext.HideoutPoint() { Hideout = context.HideoutCP, Time = Time.time }; checkedHideoutPoints.Add(hideoutPoint); } return(true); }
private static bool EvaluateAdvancement(CoverContext c, CoverPoint option, Vector3 dirCover, Vector3 dirDanger, float directness, out float result) { result = 0f; if (directness > 0.5f && dirCover.sqrMagnitude > dirDanger.sqrMagnitude) { return(false); } if (directness >= 0.5f) { float single = dirCover.sqrMagnitude; if (single > dirDanger.sqrMagnitude) { return(false); } float single1 = directness; if (single1 > c.BestAdvanceValue) { if (ConVar.AI.npc_cover_use_path_distance && c.Self.IsNavRunning() && c.Self.AttackTarget != null) { NPCPlayerApex self = c.Self as NPCPlayerApex; if (self != null && !self.PathDistanceIsValid(c.Self.AttackTarget.ServerPosition, option.Position, false)) { return(false); } } if ((option.Position - c.DangerPoint).sqrMagnitude < single) { single1 *= 0.9f; } c.BestAdvanceValue = single1; c.BestAdvanceCP = option; result = c.BestAdvanceValue; return(true); } } return(false); }
private static bool EvaluateFlanking(CoverContext c, CoverPoint option, Vector3 dirCover, Vector3 dirDanger, float directness, out float result) { result = 0f; if (directness > -0.5f && directness < 0.5f) { float single = 1f - Mathf.Abs(directness); if (single > c.BestFlankValue) { if (ConVar.AI.npc_cover_use_path_distance && c.Self.IsNavRunning() && c.Self.AttackTarget != null) { NPCPlayerApex self = c.Self as NPCPlayerApex; if (self != null && !self.PathDistanceIsValid(c.Self.AttackTarget.ServerPosition, option.Position, false)) { return(false); } } c.BestFlankValue = 0.1f - Mathf.Abs(single); c.BestFlankCP = option; result = c.BestFlankValue; return(true); } } return(false); }
public static bool Evaluate(CoverContext context, IList <IOptionScorer <CoverPoint> > scorers, List <CoverPoint> options, int numOptions, bool allScorersMustScoreAboveZero) { for (int i = 0; i < numOptions; i++) { float single = 0f; for (int j = 0; j < scorers.Count; j++) { if (!scorers[j].isDisabled) { float single1 = scorers[j].Score(context, options[i]); if (allScorersMustScoreAboveZero && single1 <= 0f) { break; } single += single1; } } } if (context.BestAdvanceCP != null || context.BestFlankCP != null) { return(true); } return(context.BestRetreatCP != null); }