public Hero GetModifierHero(ParallelQuery <Hero> allies) { return (allies.Where(x => x.Distance2D(modifierSource) <= modifierRadius) .OrderBy(x => AbilityOwner.FindRelativeAngle(x.Position)) .FirstOrDefault()); }
private Tree ChainTreePosition(Vector3 endPosition) { return(allTrees .Where( x => x.Distance2D(AbilityOwner) <= GetCastRange() && NavMesh.GetCellFlags(x.Position).HasFlag(NavMeshCellFlags.Tree) && Math.Abs( endPosition.Distance2D(x.Position) + AbilityOwner.Distance2D(x.Position) - AbilityOwner.Distance2D(endPosition)) < 20) .OrderBy(x => AbilityOwner.Distance2D(x.Position)) .ThenBy(x => AbilityOwner.FindRelativeAngle(x.Position)) .FirstOrDefault()); }