Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        /// <summary>
        /// Updates spatial data for the ball
        /// </summary>
        public void UpdateBall(Ball ball)
        {
            if (ball == null)
            {
                return;
            }

            //Do we exist?
            Ball b = _balls.getObjByID(ball._id);

            if (b == null)
            {
                return;
            }

            //Lets update
            _balls.updateObjState(b, b._state);
        }
Esempio n. 3
0
        /// <summary>
        /// Updates spatial data for the ball
        /// </summary>
        public void updateBall(Ball ball)
        {
            if (ball == null)
            {
                return;
            }

            //Do we exist?
            Ball b = _balls.getObjByID(ball._id);

            if (b == null)
            {
                Log.write(TLog.Warning, "Trying to update an invalid ball id.");
                return;
            }

            //Lets update
            _balls.updateObjState(b, b._state);

            //Update the players
            Helpers.Object_Ball(Players, ball);
        }