public TrackerUsageExample(World world) { if (null == world) { throw new ArgumentNullException("world"); } lock (world.SyncRoot) { if (null == world.Map) { throw new ArgumentException("world.Map is null"); } _world = world; lock (_lock) { PlayerProximityTracker tracker = new PlayerProximityTracker(world.Map.Width, world.Map.Length, world); _tracker.OnPlayersAtDistance += OnPlayersAtDistance; //_tracker.SetCallEvents(true, 1,(p1, p2) => p1.IsZombi != p2.IsZombi); Player.Moved += OnPlayerMoved; Player.Disconnected += OnPlayerDisconnected; Player.JoinedWorld += OnPlayerJoined; } } }
public TrackerUsageExample(World world) { if (null==world) throw new ArgumentNullException("world"); lock (world.SyncRoot) { if (null==world.Map) throw new ArgumentException("world.Map is null"); _world = world; lock (_lock) { PlayerProximityTracker tracker = new PlayerProximityTracker(world.Map.Width, world.Map.Length, world); _tracker.OnPlayersAtDistance += OnPlayersAtDistance; //_tracker.SetCallEvents(true, 1, (p1, p2) => p1.IsZombi != p2.IsZombi); Player.Moved += OnPlayerMoved; Player.Disconnected += OnPlayerDisconnected; Player.JoinedWorld += OnPlayerJoined; } } }