public override float GetScore(BaseContext ctx) { NPCHumanContext npcHumanContext = ctx as NPCHumanContext; if (npcHumanContext != null) { Scientist human = npcHumanContext.Human as Scientist; List <Scientist> allies; if (Object.op_Inequality((Object)human, (Object)null) && human.GetAlliesInRange(out allies) > 0) { foreach (Scientist scientist in allies) { Vector3 vector3_1 = Vector3.op_Subtraction(npcHumanContext.EnemyPosition, npcHumanContext.Position); Vector3 vector3_2 = Vector3.op_Subtraction(scientist.Entity.ServerPosition, npcHumanContext.Position); if ((double)((Vector3) ref vector3_2).get_sqrMagnitude() < (double)((Vector3) ref vector3_1).get_sqrMagnitude() && (double)Vector3.Dot(((Vector3) ref vector3_1).get_normalized(), ((Vector3) ref vector3_2).get_normalized()) > 0.899999976158142) { return(1f); } } } } return(0.0f); }
public override float GetScore(BaseContext ctx) { List <Scientist> scientists; float single; NPCHumanContext nPCHumanContext = ctx as NPCHumanContext; if (nPCHumanContext != null) { Scientist human = nPCHumanContext.Human as Scientist; if (human != null && human.GetAlliesInRange(out scientists) > 0) { List <Scientist> .Enumerator enumerator = scientists.GetEnumerator(); try { while (enumerator.MoveNext()) { Scientist current = enumerator.Current; Vector3 enemyPosition = nPCHumanContext.EnemyPosition - nPCHumanContext.Position; Vector3 serverPosition = current.Entity.ServerPosition - nPCHumanContext.Position; if (serverPosition.sqrMagnitude >= enemyPosition.sqrMagnitude || Vector3.Dot(enemyPosition.normalized, serverPosition.normalized) <= 0.9f) { continue; } single = 1f; return(single); } return(0f); } finally { ((IDisposable)enumerator).Dispose(); } return(single); } } return(0f); }