Example #1
0
        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////

        /// <summary>
        /// Generic constructor
        /// </summary>
        public BasicDefense(VehInfo.Car type, Helpers.ObjectState state, Arena arena, Script_CTFHQ _ctfhq, Player _owner)
            : base(type, state, arena,
                   new SteeringController(type, state, arena))
        {
            Random rnd = new Random();

            //Handle movements
            _seperation = (float)rnd.NextDouble();
            steering    = _movement as SteeringController;

            //Our weapon to use when we are close to the enemy
            _weaponClose = new WeaponController(_state, new WeaponController.WeaponSettings());
            _weaponFar   = new WeaponController(_state, new WeaponController.WeaponSettings());

            //Equip our normal weapon
            if (type.InventoryItems[0] != 0)
            {
                _weaponFar.equip(AssetManager.Manager.getItemByID(type.InventoryItems[0]));
            }

            //Setup our second weapon
            if (type.InventoryItems[1] != 0)
            {
                _weaponClose.equip(AssetManager.Manager.getItemByID(type.InventoryItems[1]));
            }



            ctfhq = _ctfhq;
            owner = _owner;
        }
Example #2
0
        public bool deadBall = false;     //Is this ball stuck/unplayabe?

        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////
        #region Member Constructors
        /// <summary>
        /// Generic constructor
        /// </summary>
        public Ball(Player player, short ballID)
        {   //Populate variables
            _id    = (ushort)ballID;
            _arena = player._arena;

            _state = new Helpers.ObjectState();
        }
Example #3
0
        public void spawnRandomWave(Team team, int count)
        {
            Helpers.ObjectState warpPoint = _baseScript.findFlagWarp(_botTeam, true);
            Helpers.ObjectState openPoint = new Helpers.ObjectState();

            Random rand = new Random();

            if (warpPoint == null)
            {
                return;
            }

            for (int i = 0; i < count; i++)
            {
                BotType type    = BotType.Marine;
                bool    bRipper = (rand.Next(0, 100) <= 35);

                if (bRipper)
                {
                    type = BotType.Ripper;
                }


                short randomoffset = (short)(warpPoint.positionX + rand.Next(0, 800));
                openPoint = _baseScript.findOpenWarp(_botTeam, _arena, randomoffset, warpPoint.positionY, 1200);


                if (!newBot(team, type, null, null, openPoint))
                {
                    Log.write(TLog.Warning, "Unable to spawn bot");
                }
            }

            _arena.triggerMessage(0, 500, "Enemy reinforcements have arrived!");
        }
Example #4
0
        public void spawnFort(FortificationType type)
        {
            _arena.sendArenaMessage("!Scouts are reporting enemy Fortification up ahead, keep a lookout!", 4);
            Helpers.ObjectState warpPoint = _baseScript.findFlagWarp(_botTeam, false);

            Fortification newFort = new Fortification(type, warpPoint.positionX, warpPoint.positionY, _botTeam, _arena);
        }
Example #5
0
        public void spawnLightFort()
        {
            Helpers.ObjectState objState = new Helpers.ObjectState();
            short pX, pY;

            pX       = (short)(_state.positionX - 175);
            pY       = (short)(_state.positionY - 175);
            objState = getRandomPosition(pX, pY, 200);
            _arena.newVehicle(Types.barricade, _team, null, objState);

            pX       = (short)(_state.positionX - 175);
            pY       = (short)(_state.positionY + 175);
            objState = getRandomPosition(pX, pY, 200);
            _arena.newVehicle(Types.barricade, _team, null, objState);

            pX       = (short)(_state.positionX);
            pY       = (short)(_state.positionY + 250);
            objState = getRandomPosition(pX, pY, 200);
            _arena.newVehicle(Types.bunkerMarine, _team, null, objState);

            pX       = (short)(_state.positionX);
            pY       = (short)(_state.positionY - 250);
            objState = getRandomPosition(pX, pY, 200);
            _arena.newVehicle(Types.bunkerRipper, _team, null, objState);
        }
Example #6
0
        public void drawVerticalBoundaryShrink(int now)
        {
            short circleMarkLocation         = _left;
            short distanceBetweenCircleMarks = 100;

            Helpers.ObjectState state  = new Helpers.ObjectState();
            Helpers.ObjectState target = new Helpers.ObjectState();
            state.positionX  = _right;
            state.positionY  = _top;
            target.positionX = _right;
            target.positionY = _bottom;
            byte fireAngle = Helpers.computeLeadFireAngle(state, target, 20000 / 1000);

            while (circleMarkLocation < _right)
            {
                Helpers.Player_RouteExplosion(_arena.Players, 1473, circleMarkLocation, _top, 0, fireAngle, 0);
                Helpers.Player_RouteExplosion(_arena.Players, 1473, circleMarkLocation, _bottom, 0, fireAngle, 0);
                circleMarkLocation += distanceBetweenCircleMarks;
            }


            circleMarkLocation = _previousTop;
            while (circleMarkLocation < _previousBottom)
            {
                Helpers.Player_RouteExplosion(_arena.Players, 1473, _left, circleMarkLocation, 0, fireAngle, 0);
                Helpers.Player_RouteExplosion(_arena.Players, 1473, _right, circleMarkLocation, 0, fireAngle, 0);
                circleMarkLocation += distanceBetweenCircleMarks;
            }
        }
Example #7
0
        public void drawHorizontalBoundaryShrink(int now)
        {
            Helpers.ObjectState state  = new Helpers.ObjectState();
            Helpers.ObjectState target = new Helpers.ObjectState();

            state.positionX  = _right;
            state.positionY  = _bottom;
            target.positionX = _right;
            target.positionY = _top;

            byte fireAngle = Helpers.computeLeadFireAngle(state, target, 20000 / 1000);

            fireAngle = Helpers.computeLeadFireAngle(state, target, 20000 / 1000);                 // Right, Bottom to Top
            Helpers.Player_RouteExplosion(_arena.Players, 1472, _right, _bottom, 0, fireAngle, 0); //vis


            Helpers.Player_RouteExplosion(_arena.Players, 1472, _nextRight, _nextBottom, 0, fireAngle, 0);    //vis where it ends

            state.positionX  = _left;
            state.positionY  = _top;
            target.positionX = _left;
            target.positionY = _bottom;

            fireAngle = Helpers.computeLeadFireAngle(state, target, 20000 / 1000);             //Left, Top to Bottom
            Helpers.Player_RouteExplosion(_arena.Players, 1472, _left, _top, 0, fireAngle, 0); // vis


            Helpers.Player_RouteExplosion(_arena.Players, 1472, _nextLeft, _nextTop, 0, fireAngle, 0); // vis where it ends
        }
Example #8
0
        public void updateObjState(T from, Helpers.ObjectState state)
        {       //Make sure he's one of ours
            try
            {
                if (!Contains(from))
                {
                    Log.write(TLog.Warning, "Given object state update for unknown object {0}.", from);
                    return;
                }
            }
            catch (Exception e)
            {
                Log.write(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;
            }
        }
Example #9
0
        public Ball(short ballID, Arena arena)
        {       //Populate variables
            _id    = (ushort)ballID;
            _arena = arena;

            _state = new Helpers.ObjectState();
        }
Example #10
0
        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////

        /// <summary>
        /// Generic constructor
        /// Type = Vehicle bot uses
        /// State = direction and location of bot for spawn
        /// Arena = the arena the bot is in
        /// Team = the team the bot is on
        /// Lane = the lane the bot is assigned to [0=top,1=mid,2=bottom]
        /// Side = the side we are on, 0 = left -- 1 = right
        /// </summary>
        public RangeMinion(VehInfo.Car type, Helpers.ObjectState state, Arena arena, Script_MOBA moba, Team team, int lane, int side)
        //: base(
            : base(type, state, arena,
                   new SteeringController(type, state, arena))
        {
            Random rnd = new Random(Environment.TickCount);

            _lane      = lane;
            _team      = team;
            _moba      = moba;
            _attacking = false;
            _side      = side;

            if (_side == 0)
            {
                _atWaypoint = 0;
            }
            else
            {
                _atWaypoint = _maxWaypoints;
            }

            _seperation = (float)rnd.NextDouble();
            steering    = _movement as SteeringController;


            if (type.InventoryItems[0] != 0)
            {
                _weapon.equip(AssetManager.Manager.getItemByID(type.InventoryItems[0]));
            }
        }
Example #11
0
        public void drawNextRectangleBoundary()
        {
            short circleMarkLocation         = _nextLeft;
            short distanceBetweenCircleMarks = 100;

            Helpers.ObjectState state  = new Helpers.ObjectState();
            Helpers.ObjectState target = new Helpers.ObjectState();
            state.positionX  = _right;
            state.positionY  = _top;
            target.positionX = _right;
            target.positionY = _bottom;
            byte fireAngle = Helpers.computeLeadFireAngle(state, target, 20000 / 1000);

            while (circleMarkLocation < _nextRight)
            {
                Helpers.Player_RouteExplosion(_arena.Players, 1471, circleMarkLocation, _nextTop, 0, fireAngle, 0);
                Helpers.Player_RouteExplosion(_arena.Players, 1471, circleMarkLocation, _nextBottom, 0, fireAngle, 0);
                circleMarkLocation += distanceBetweenCircleMarks;
            }

            if (Width != nextWidth)
            {
                circleMarkLocation = _nextTop;
                while (circleMarkLocation < _nextBottom)
                {
                    Helpers.Player_RouteExplosion(_arena.Players, 1471, _nextLeft, circleMarkLocation, 0, fireAngle, 0);
                    Helpers.Player_RouteExplosion(_arena.Players, 1471, _nextRight, circleMarkLocation, 0, fireAngle, 0);
                    circleMarkLocation += distanceBetweenCircleMarks;
                }
            }
        }
Example #12
0
        public void init(Helpers.ObjectState spawn, Script_Multi script)
        {
            _script = script;
            Arena.FlagState flag;
            if (_team._name == "Titan Militia")
            {
                flag = _arena._flags.Values.OrderByDescending(f => f.posX).Where(f => f.team == _team).First();
            }
            else
            {
                flag = _arena._flags.Values.OrderByDescending(f => f.posX).Where(f => f.team == _team).First();
            }

            Helpers.ObjectState dropPoint = findOpenSpawn((short)(flag.posX + 900), 1744, 1000);

            spawn.positionZ = 0;
            _supplyMarker   = _arena.newVehicle(AssetManager.Manager.getVehicleByID(406), _team, null, dropPoint);
            _spawnMarker    = _arena.newVehicle(AssetManager.Manager.getVehicleByID(407), _team, null, spawn);

            if (_supplyMarker == null)
            {
                Log.write(TLog.Warning, "Unable to spawn supply drop marker");
            }

            if (_spawnMarker == null)
            {
                Log.write(TLog.Warning, "Unable to spawn supply drop spawn marker");
            }


            _arena.sendArenaMessage(String.Format("&Supplies inbound to your coordinates ({0}), Sit tight Soldiers!",
                                                  Helpers.posToLetterCoord(_supplyMarker._state.positionX, _supplyMarker._state.positionY)), 4);

            _targetLocation = _supplyMarker;
        }
Example #13
0
        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////
        /// <summary>
        /// Generic Constructor
        /// </summary>
        public WeaponController(Helpers.ObjectState state, WeaponSettings settings)
        {
            _state    = state;
            _settings = settings;

            bEquipped = false;
        }
Example #14
0
        /// <summary>
        /// Determines whether the bot needs to aim to clockwise, anticlockwise or is ontarget
        /// </summary>
        public int testAim(Helpers.ObjectState target, out bool bAimed)
        {               //Compute our lead fire angle
            int fireAngle = Helpers.computeLeadFireAngle(_state, target, _primaryProjectile.muzzleVelocity / 1000);

            //Calculate the smallest angle difference
            int angleDiffHi = fireAngle - _state.yaw;
            int angleDiffLo = (angleDiffHi < 0) ? 240 - Math.Abs(angleDiffHi) : -(240 - Math.Abs(angleDiffHi));

            int angleDiff;

            if (Math.Abs(angleDiffHi) < Math.Abs(angleDiffLo))
            {
                angleDiff = angleDiffHi;
            }
            else
            {
                angleDiff = angleDiffLo;
            }

            //Is it in range according to our fuzziness factor?
            bAimed = (Math.Abs(angleDiff) <= (_settings.aimFuzziness / 2));

            //Which direction do we need to aim in?
            if (angleDiff > 0)
            {
                //Aim clockwise
                return(1);
            }
            else
            {
                //Aim anticlockwise
                return(-1);
            }
        }
Example #15
0
        public Func <InfantryVehicle, Vector3> steerDelegate; //Delegate which calculates how much steering to apply


        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////
        /// <summary>
        /// Generic Constructor
        /// </summary>
        public SteeringController(VehInfo.Car type, Helpers.ObjectState state, Arena arena)
            : base(type, state, arena)
        {
            vehicle = new InfantryVehicle(type, _state);

            //Set our position
            vehicle.Position = _state.position();
        }
Example #16
0
        public static bool inArea(this Player player, int xMin, int yMin, int xMax, int yMax)
        {
            Helpers.ObjectState state = player.getState();
            int px = state.positionX;
            int py = state.positionY;

            return(xMin <= px && px <= xMax && yMin <= py && py <= yMax);
        }
Example #17
0
        public void drawNextBoundary()
        {
            Helpers.ObjectState state  = new Helpers.ObjectState();
            Helpers.ObjectState target = new Helpers.ObjectState();
            short _nextMiddle          = (short)(_nextTop + (_nextBottom - _nextTop) / 2);
            short _nextMiddleTop       = (short)(_nextTop + (_nextMiddle - _nextTop) / 2);
            short _nextMiddleBottom    = (short)(_nextMiddle + (_nextBottom - _nextMiddle) / 2);

            state.positionX  = _nextRight;
            state.positionY  = _nextBottom;
            target.positionX = _nextRight;
            target.positionY = _nextTop;

            byte fireAngle = Helpers.computeLeadFireAngle(state, target, 20000 / 1000);

            fireAngle = Helpers.computeLeadFireAngle(state, target, 20000 / 1000);                               // Right, Bottom to Top
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextRight, _nextBottom, 0, fireAngle, 0);
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextRight, _nextMiddle, 0, fireAngle, 0);       //Middle
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextRight, _nextMiddleTop, 0, fireAngle, 0);    //MiddleTop
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextRight, _nextMiddleBottom, 0, fireAngle, 0); //MiddleBottom
            Helpers.Player_RouteExplosion(_arena.Players, 1468, _nextRight, _nextBottom, 0, fireAngle, 0);       //vis


            state.positionX  = _nextRight;
            state.positionY  = _nextTop;
            target.positionX = _nextRight;
            target.positionY = _nextBottom;

            fireAngle = Helpers.computeLeadFireAngle(state, target, 20000 / 1000);                               //Right, Top to Bottom
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextRight, _nextTop, 0, fireAngle, 0);
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextRight, _nextMiddle, 0, fireAngle, 0);       // Middle
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextRight, _nextMiddleTop, 0, fireAngle, 0);    // MiddleTop
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextRight, _nextMiddleBottom, 0, fireAngle, 0); // MiddleBottom

            state.positionX  = _nextLeft;
            state.positionY  = _nextTop;
            target.positionX = _nextLeft;
            target.positionY = _nextBottom;

            fireAngle = Helpers.computeLeadFireAngle(state, target, 20000 / 1000);                              //Left, Top to Bottom
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextLeft, _nextTop, 0, fireAngle, 0);
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextLeft, _nextMiddle, 0, fireAngle, 0);       // Middle
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextLeft, _nextMiddleTop, 0, fireAngle, 0);    // MiddleTop
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextLeft, _nextMiddleBottom, 0, fireAngle, 0); // MiddleBottom
            Helpers.Player_RouteExplosion(_arena.Players, 1468, _nextLeft, _nextTop, 0, fireAngle, 0);          // vis


            state.positionX  = _nextLeft;
            state.positionY  = _nextBottom;
            target.positionX = _nextLeft;
            target.positionY = _nextTop;

            fireAngle = Helpers.computeLeadFireAngle(state, target, 20000 / 1000);                              //Left, Bottom to Top
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextLeft, _nextBottom, 0, fireAngle, 0);
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextLeft, _nextMiddle, 0, fireAngle, 0);       //From Middle
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextLeft, _nextMiddleTop, 0, fireAngle, 0);    //From MiddleTop
            Helpers.Player_RouteExplosion(_arena.Players, 1463, _nextLeft, _nextMiddleBottom, 0, fireAngle, 0); //From MiddleBottom
        }
Example #18
0
        public void spawnMedic(Team team)
        {
            Helpers.ObjectState warpPoint = _baseScript.findFlagWarp(_team, true);

            if (!newBot(team, BotType.Medic, null, null, warpPoint))
            {
                Log.write(TLog.Warning, "Unable to spawn medic bot");
            }
        }
Example #19
0
        /// <summary>
        /// Finds a specific point within a radius with no physics for a player to warp to
        /// </summary>
        /// <param name="arena"></param>
        /// <param name="posX"></param>
        /// <param name="posY"></param>
        /// <param name="radius"></param>
        /// <returns></returns>
        public Helpers.ObjectState findOpenWarp(Team team, Arena arena, short posX, short posY, int radius)
        {
            Helpers.ObjectState warpPoint = null;


            try
            {
                int blockedAttempts = 10;

                int enemycount = _arena.getPlayersInRange(posX, posY, _engagedRadius).Where(p => p._team != team).Count();
                if (team._name == "Titan Militia" && enemycount > 0)
                {
                    posX = (short)(posX - ScaleOffset());
                }
                if (team._name == "Collective Military" && enemycount > 0)
                {
                    posX = (short)(posX + ScaleOffset());
                }


                short pX;
                short pY;

                while (true)
                {
                    pX = posX;
                    pY = posY;
                    Helpers.randomPositionInArea(arena, radius, ref pX, ref pY);
                    if (arena.getTile(pX, pY).Blocked)
                    {
                        blockedAttempts--;
                        if (blockedAttempts <= 0)
                        {
                            //Consider the area to be blocked
                            return(null);
                        }
                        else
                        {
                            continue;
                        }
                    }

                    warpPoint           = new Helpers.ObjectState();
                    warpPoint.positionX = pX;
                    warpPoint.positionY = pY;


                    break;
                }
            }
            catch (Exception ex)
            {
                Log.write(TLog.Exception, ex.Message);
            }
            return(warpPoint);
        }
        /// <summary>
        /// Warps the bot to the specified location
        /// </summary>
        public void warp(Helpers.ObjectState warpTo)
        {
            //Modify it's position first
            _position        = new Vector2(warpTo.positionX, warpTo.positionY);
            _state.positionX = warpTo.positionX;
            _state.positionY = warpTo.positionY;

            //Update
            updateState(0);
        }
Example #21
0
        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////

        /// <summary>
        /// Generic constructor
        /// Type = Vehicle bot uses
        /// State = direction and location of bot for spawn
        /// Arena = the arena the bot is in
        /// </summary>
        public RangeMinion(VehInfo.Car type, Helpers.ObjectState state, Arena arena, Script_Fantasy script, int ID)
        //: base(
            : base(type, state, arena,
                   new SteeringController(type, state, arena))
        {
            Random rnd = new Random(Environment.TickCount);

            _attacking = false;

            _seperation = (float)rnd.NextDouble();
            steering    = _movement as SteeringController;


            //Assign all our stats
            foreach (var p in script._spawns)
            {
                if (p.ID == ID)
                {//Found our entry, now set all the settings
                    //Targetting settings
                    targetBot      = p.atkBots;
                    targetVehicles = p.atkVeh;
                    targetPlayer   = p.atkPlayer;

                    _homeID = p.spawnID;
                    _vehID  = p.vehID;
                    //Spawn point settings
                    //p.relyOnSpawn;

                    //Distances
                    _defenseRadius    = p.defenseRadius;
                    _distanceFromHome = p.distanceFromHome;
                    _radiusToPatrol   = p.patrolRadius;
                    _lockInTime       = p.lockInTime;
                    _attackRadius     = p.attackRadius;
                    foreach (var w in p._weapons)
                    {
                        _weapons.Add(new BotWeapon(w.ID));
                        _weapons[w.ID].weaponID       = w.weaponID;
                        _weapons[w.ID].allChance      = w.allChance;
                        _weapons[w.ID].shortChance    = w.shortChance;
                        _weapons[w.ID].midChance      = w.midChance;
                        _weapons[w.ID].longChance     = w.longChance;
                        _weapons[w.ID].preferredRange = w.preferredRange;
                    }
                    _midRange  = p.shortRange + 1;
                    _longRange = p.longRange + 1;
                }
            }
            //By default set out current weapon to close range
            if (type.InventoryItems[0] != 0)
            {
                _weapon.equip(AssetManager.Manager.getItemByID(type.InventoryItems[0]));
            }
        }
Example #22
0
        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////
        /// <summary>
        /// Generic Constructor
        /// </summary>
        public InfantryVehicle(VehInfo.Car type, Helpers.ObjectState _state)
        {
            vehicleType = type;
            state       = _state;

            Reset();

            SpeedValues stats = vehicleType.TerrainSpeeds[0];

            MaxForce = ((stats.RollThrust * 4800) / 128) / 1000;
            MaxSpeed = stats.RollTopSpeed / 1000;
        }
Example #23
0
        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////
        /// <summary>
        /// Generic constructor
        /// </summary>
        public DualZombieBot(VehInfo.Car type, Helpers.ObjectState state, Arena arena, Script_ZombieZone _zz)
            : base(type, state, arena, _zz)
        {
            bOverriddenPoll = true;
            _weaponClose    = new WeaponController(_state, new WeaponController.WeaponSettings());

            //Setup our second weapon
            if (type.InventoryItems[1] != 0)
            {
                _weaponClose.equip(AssetManager.Manager.getItemByID(type.InventoryItems[1]));
            }
        }
Example #24
0
        public void spawnDropShip(Team team)
        {
            Helpers.ObjectState warpPoint = new Helpers.ObjectState();
            warpPoint.positionX = 400;
            warpPoint.positionY = 1744;
            warpPoint.positionZ = 299;

            if (!newBot(team, BotType.Dropship, null, null, warpPoint))
            {
                Log.write(TLog.Warning, "Unable to spawn medic bot");
            }
        }
Example #25
0
        /// <summary>
        /// Add a player to the player tracker
        /// </summary>
        public void Add(T p)
        {               //Set the given id
            _idToObj[p.getID()] = p;

            Helpers.ObjectState state  = p.getState();
            List <T>            bucket = _matrix[state.positionX / BUCKET_TICKS, state.positionY / BUCKET_TICKS];

            _objToBucket[p] = bucket;

            // Insert player into the right bucket
            bucket.Add(p);
        }
        /// <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>();

            _abstract = new VehicleAbstract(this);
        }
Example #27
0
        protected SteeringController steering;  //System for controlling the bot's steering


        public Chopper(VehInfo.Car type, Helpers.ObjectState state, Arena arena)
        //: base(
            : base(type, state, arena,
                   new SteeringController(type, state, arena))
        {
            Random rnd = new Random(Environment.TickCount);

            steering = _movement as SteeringController;

            if (type.InventoryItems[0] != 0)
            {
                _weapon.equip(AssetManager.Manager.getItemByID(type.InventoryItems[0]));
            }
        }
Example #28
0
        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////
        /// <summary>
        /// Generic constructor
        /// </summary>
        public RipperV2(VehInfo.Car type, Helpers.ObjectState state, Arena arena)
            : base(type, state, arena)
        {
            //bOverriddenPoll = true;
            fireDist  = 6.9f;
            farDist   = 3.4f;
            shortDist = 1.2f;
            runDist   = 0.2f;

            if (type.InventoryItems[0] != 0)
            {
                _weapon.equip(AssetManager.Manager.getItemByID(type.InventoryItems[0]));
            }
        }
Example #29
0
        /// <summary>
        /// Calculates the AbstractVehicle fields based on the object state given
        /// </summary>
        public void calculate()
        {
            state = owner._state;

            Position = state.position();

            //Calculate the local space
            speed = state.velocity().Normalize();

            if (speed > 0)
            {
                RegenerateOrthonormalBasisUF(state.velocity() / speed);
            }
        }
Example #30
0
        ///////////////////////////////////////////////////
        // Member Functions
        ///////////////////////////////////////////////////

        /// <summary>
        /// Generic constructor
        /// </summary>
        public RoamingAttacker(VehInfo.Car type, Helpers.ObjectState state, Arena arena)
            : base(type, state, arena,
                   new SteeringController(type, state, arena))
        {
            Random rnd = new Random();

            _seperation = (float)rnd.NextDouble();
            steering    = _movement as SteeringController;

            if (type.InventoryItems[0] != 0)
            {
                _weapon.equip(AssetManager.Manager.getItemByID(type.InventoryItems[0]));
            }
        }