Пример #1
0
        /// <summary>
        /// Moves the AI on a persuit course towards the player, while keeping seperated from other AI
        /// </summary>
        public Vector3 steerForAttack(InfantryVehicle vehicle)
        {
            if (target == null)
            {
                return(Vector3.Zero);
            }

            List <Vehicle> soldiers = _arena.getVehiclesInRange(vehicle.state.positionX, vehicle.state.positionY, 500,
                                                                delegate(Vehicle v)
                                                                { return(v is Troop); });
            IEnumerable <IVehicle> soldierbots = soldiers.ConvertAll <IVehicle>(
                delegate(Vehicle v)
            {
                return((v as Troop).Abstract);
            }
                );

            Vector3 cohesionSteer   = vehicle.SteerForCohesion(_seperation, 0.07f, soldierbots.ToList());
            Vector3 seperationSteer = vehicle.SteerForSeparation(_seperation, -1.707f, soldierbots);
            Vector3 pursuitSteer    = vehicle.SteerForPursuit(target._baseVehicle.Abstract, 0.2f);

            _bStrafe = true;

            return((seperationSteer * 1.3f) + pursuitSteer);
        }
Пример #2
0
        /// <summary>
        /// Moves the bot on a persuit course towards the player, while keeping seperated from otherbots
        /// </summary>
        public Vector3 steerForPersuePlayer(InfantryVehicle vehicle)
        {
            List <Vehicle> bots = _arena.getVehiclesInRange(vehicle.state.positionX, vehicle.state.positionY, 400,
                                                            delegate(Vehicle v)
                                                            { return(v is Bot); });
            IEnumerable <IVehicle> gbots = bots.ConvertAll <IVehicle>(
                delegate(Vehicle v)
            {
                return((v as Bot).Abstract);
            }
                );

            Vector3 seperationSteer = vehicle.SteerForSeparation(_seperation, -0.707f, gbots);
            Vector3 pursuitSteer    = vehicle.SteerForPursuit(targetEnemy._baseVehicle.Abstract, 0.2f);

            return((seperationSteer * 0.6f) + pursuitSteer);
        }
Пример #3
0
        /// <summary>
        /// Keeps the combat bot around the engineer
        /// Change to keeping him around the HQ
        /// </summary>
        public Vector3 steerForFollowOwner(InfantryVehicle vehicle)
        {
            List <Vehicle> bots = _arena.getVehiclesInRange(vehicle.state.positionX, vehicle.state.positionY, 400,
                                                            delegate(Vehicle v)
                                                            { return(v is Bot); });
            IEnumerable <IVehicle> gbots = bots.ConvertAll <IVehicle>(
                delegate(Vehicle v)
            {
                return((v as Bot).Abstract);
            }
                );

            Vector3 seperationSteer = vehicle.SteerForSeparation(50f, -0.707f, gbots);
            //Vector3 seperationSteer = vehicle.SteerForAlignment(100f, -0.707f, gbots);
            // Vector3 wanderSteer = vehicle.SteerForWander(0.5f);
            Vector3 pursuitSteer = vehicle.SteerForPursuit(_targetVehicle.Abstract, 0.2f);

            return((seperationSteer * 0.6f) + pursuitSteer);
        }
Пример #4
0
        /// <summary>
        /// Moves the zombie on a persuit course towards the player, while keeping seperated from other zombies
        /// </summary>
        public Vector3 steerForPersuePlayer(InfantryVehicle vehicle)
        {
            if (victim == null)
            {
                return(Vector3.Zero);
            }

            List <Vehicle> zombies = _arena.getVehiclesInRange(vehicle.state.positionX, vehicle.state.positionY, 400,
                                                               delegate(Vehicle v)
                                                               { return(v is ZombieBot); });
            IEnumerable <IVehicle> zombiebots = zombies.ConvertAll <IVehicle>(
                delegate(Vehicle v)
            {
                return((v as ZombieBot).Abstract);
            }
                );

            Vector3 seperationSteer = vehicle.SteerForSeparation(_seperation, -0.707f, zombiebots);
            Vector3 pursuitSteer    = vehicle.SteerForPursuit(victim._baseVehicle.Abstract, 0.2f);

            return((seperationSteer * 0.6f) + pursuitSteer);
        }
Пример #5
0
        /// <summary>
        /// Moves the medic on a persuit course towards the player, while keeping seperated from other medics
        /// </summary>
        public Vector3 steerForPersuePlayer(InfantryVehicle vehicle)
        {
            if (_target == null)
            {
                return(Vector3.Zero);
            }

            List <Vehicle> medics = _arena.getVehiclesInRange(vehicle.state.positionX, vehicle.state.positionY, 150,
                                                              delegate(Vehicle v)
                                                              { return(v is Medic); });
            IEnumerable <IVehicle> medicbots = medics.ConvertAll <IVehicle>(
                delegate(Vehicle v)
            {
                return((v as Medic).Abstract);
            }
                );

            Vector3 seperationSteer = vehicle.SteerForSeparation(_seperation, -0.307f, medicbots);
            Vector3 pursuitSteer    = vehicle.SteerForPursuit(_target._baseVehicle.Abstract, 0.2f);

            return((seperationSteer * 0.3f) + pursuitSteer);
        }
Пример #6
0
        /// <summary>
        /// Moves the medic on a persuit course towards the player, while keeping seperated from other medics
        /// </summary>
        public Vector3 steerForPersuePlayer(InfantryVehicle vehicle)
        {
            if (targetEnemy == null)
            {
                return(Vector3.Zero);
            }

            List <Vehicle> dropships = _arena.getVehiclesInRange(vehicle.state.positionX, vehicle.state.positionY, 500,
                                                                 delegate(Vehicle v)
                                                                 { return(v is Dropship); });
            IEnumerable <IVehicle> dropshipbots = dropships.ConvertAll <IVehicle>(
                delegate(Vehicle v)
            {
                return((v as Dropship).Abstract);
            }
                );

            Vector3 seperationSteer = vehicle.SteerForSeparation(_seperation, -0.707f, dropshipbots);
            Vector3 pursuitSteer    = vehicle.SteerForPursuit(targetEnemy.Abstract, 0.2f);

            return((seperationSteer * 1.3f) + pursuitSteer);
        }