Ejemplo n.º 1
0
        public void updateObjState(T from, Helpers.ObjectState state)
        {       //Make sure he's one of ours
            try
            {
                if (!Contains(from))
                {
                    InfServer.Log.write(InfServer.TLog.Warning, "Given object state update for unknown object {0}.", from);
                    return;
                }
            }
            catch (Exception e)
            {
                InfServer.Log.write(InfServer.TLog.Warning, String.Format("{0} Details = {1}, {2}", e.ToString(), _idToObj.Count(), from.getID()));
            }

            // Update the bucket if it's not correct
            List <T> newBucket = _matrix[state.positionX / BUCKET_TICKS, state.positionY / BUCKET_TICKS];
            List <T> oldBucket;

            if (!_objToBucket.TryGetValue(from, out oldBucket))
            {
                _objToBucket[from] = newBucket;
            }
            else if (oldBucket != newBucket)
            {   // Move buckets
                oldBucket.Remove(from);
                newBucket.Add(from);

                _objToBucket[from] = newBucket;
            }
        }
Ejemplo n.º 2
0
        ///////////////////////////////////////////////////
        // Member Classes
        ///////////////////////////////////////////////////
        #region Member Classes

        #endregion

        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////
        /// <summary>
        /// Generic constructor
        /// </summary>
        public Vehicle(VehInfo type, Arena arena)
        {       //Populate variables
            _type  = type;
            _arena = arena;

            _childs = new List <Vehicle>();

            _state = new Helpers.ObjectState();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Generic constructor
        /// </summary>
        public Vehicle(VehInfo type, Helpers.ObjectState state, Arena arena)
        {       //Populate variables
            _type  = type;
            _arena = arena;

            _childs = new List <Vehicle>();

            _state     = state;
            _attackers = new List <Player>();
        }
Ejemplo n.º 4
0
        public Team _team;                      //The team we belong to

        public Player(bool local)
        {
            _state = new Helpers.ObjectState();
        }