SimpleSoccer.Net.PlayerBase.IsThreatened C# (CSharp) Method

IsThreatened() public method

public IsThreatened ( ) : bool
return bool
        public bool IsThreatened()
        {
            for (int opponentIndex = 0; opponentIndex < Team.OpposingTeam.Players.Count; opponentIndex++)
            {
                //calculate distance to the player. if dist is less than our
                //comfort zone, and the opponent is infront of the player, return true
                if (IsPositionInFrontOfPlayer(Team.OpposingTeam.Players[opponentIndex].Position) &&
                   (Vector2D.Vec2DDistanceSq(Position, Team.OpposingTeam.Players[opponentIndex].Position) < ParameterManager.Instance.PlayerComfortZoneSq))
                {
                    return true;
                }

            }// next opp

            return false;
        }