public PlayersData GetPlayersFullData(SeenCoachObject me) { var status = GetPlayersData(); PlayersData ret = new PlayersData() { MyPlayers = new Dictionary <SeenCoachObject, PlayerData>(), OpponentPlayers = new Dictionary <SeenCoachObject, PlayerData>() }; foreach (var player in status.MyPlayers) { ret.MyPlayers.Add(player, new PlayerData() { Angle = GetAngle(me, player), Distance = GetDistance(me, player), DistanceFromBall = GetDistanceFromBall(player) }); } foreach (var player in status.OpponentPlayers) { ret.OpponentPlayers.Add(player, new PlayerData() { Angle = GetAngle(me, player), Distance = GetDistance(me, player), DistanceFromBall = GetDistanceFromBall(player) }); } return(ret); }
public SeenCoachObject GetNearestPlayerAvialible(SeenCoachObject me) { PlayersData dic = GetPlayersFullData(me); PlayerData best_player_data = new PlayerData(); best_player_data.Angle = 0; best_player_data.Distance = 100; SeenCoachObject best_player_obj = me; foreach (var p in dic.MyPlayers) { if (p.Value.Distance > 0.5 && p.Value.Distance < best_player_data.Distance && PlayerAvialible(p.Value.Angle, dic.OpponentPlayers)) { best_player_data = p.Value; best_player_obj = p.Key; } } return(best_player_obj); }