/// <summary> /// Reset all active balls in the arena /// </summary> public void resetBalls() { //Get rid of each ball foreach (Ball b in _balls.ToList()) { lostBall(b); } }
public int _botsInArena; //How many bots currently in the arena /////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Takes care of all bots in the arena /// </summary> private void pollBots() { //Handle each bot foreach (Bot bot in _bots.ToList()) { //Does it need to send an update? if (bot.poll()) { //Prepare and send an update packet for the vehicle bot._state.updateNumber++; Helpers.Update_RouteBot(bot); //Update the bot's state if (!bot.bCondemned) { _vehicles.updateObjState(bot, bot._state); _bots.updateObjState(bot, bot._state); } //Only shoot once! bot._itemUseID = 0; } if (bot.bCondemned) { _condemnedBots.Add(bot); } } foreach (Bot bot in _condemnedBots) { _bots.Remove(bot); } _condemnedBots.Clear(); }
// Member Functions ////////////////////////////////////////////// /// <summary> /// Looks after every playable ball in the arena /// </summary> private void pollBalls() { //Is this a ball type zone? if (_balls == null || _balls.Count() == 0) { return; } int now = Environment.TickCount; //Update game state? if (now - _lastUpdateState <= gameCheckInterval) { return; } _lastUpdateState = now; //Do we need to send an update? if ((now - _lastUpdateSent) > (_server._zoneConfig.soccer.sendTime * 10)) { foreach (Ball ball in _balls.ToList()) { //Lets visually update Ball.Route_Ball(Players, ball); _lastUpdateSent = now; //Check for an unreachable ball stuckBall(ball, now); //Check for a dead ball(untouched) deadBall(ball, now); } } //Do we need to update our state? int delta = now - _lastDelta; if (delta < 0) { return; } _lastDelta = now; //foreach(Ball ball in _balls) //UpdateState(ball, delta); }