Esempio n. 1
0
        public bool RemoveGangCar(PotentialGangVehicle sadVehicle)
        {
            for (int i = 0; i < carVariations.Count; i++)
            {
                if (sadVehicle.modelHash != carVariations[i].modelHash)
                {
                    continue;
                }
                else
                {
                    carVariations.Remove(carVariations[i]);

                    //if we're AI and we're out of cars, get a replacement for this one
                    if (carVariations.Count == 0 && !isPlayerOwned)
                    {
                        carVariations.Add(PotentialGangVehicle.GetCarFromPool());
                    }

                    GangManager.instance.SaveGangData();
                    return(true);
                }
            }

            return(false);
        }
 public bool HasIdenticalEntry(PotentialGangVehicle potentialEntry)
 {
     for (int i = 0; i < carList.Count; i++)
     {
         if (carList[i].modelHash == potentialEntry.modelHash)
         {
             return(true);
         }
     }
     return(false);
 }
        public static bool AddVehicleAndSavePool(PotentialGangVehicle newCar)
        {
            //check if there isn't an identical entry in the pool
            if (!CarPool.HasIdenticalEntry(newCar))
            {
                CarPool.carList.Add(newCar);
                PersistenceHandler.SaveToFile <PotentialCarPool>(CarPool, "VehiclePool");
                return(true);
            }

            return(false);
        }
 public bool HasIdenticalEntry(PotentialGangVehicle potentialEntry, ref int identicalEntryIndex)
 {
     for (int i = 0; i < carList.Count; i++)
     {
         if (carList[i].modelHash == potentialEntry.modelHash)
         {
             identicalEntryIndex = i;
             return(true);
         }
     }
     identicalEntryIndex = -1;
     return(false);
 }
        public static bool RemoveVehicleAndSavePool(PotentialGangVehicle newCar)
        {
            int identicalEntryIndex = 0;

            //check if there is an identical entry in the pool
            if (CarPool.HasIdenticalEntry(newCar, ref identicalEntryIndex))
            {
                CarPool.carList.RemoveAt(identicalEntryIndex);
                PersistenceHandler.SaveToFile <PotentialCarPool>(CarPool, "VehiclePool");
                return(true);
            }

            return(false);
        }
Esempio n. 6
0
        public bool AddGangCar(PotentialGangVehicle newVehicleType)
        {
            for (int i = 0; i < carVariations.Count; i++)
            {
                if (newVehicleType.modelHash != carVariations[i].modelHash)
                {
                    continue;
                }
                else
                {
                    return(false);
                }
            }

            carVariations.Add(newVehicleType);
            GangManager.instance.SaveGangData();
            return(true);
        }
Esempio n. 7
0
        public GangAI(Gang watchedGang)
        {
            this.watchedGang = watchedGang;
            ResetUpdateInterval();

            //have some turf for free! but only if you're new around here
            DoInitialTakeover();

            //do we have vehicles?
            if (this.watchedGang.carVariations.Count == 0)
            {
                //get some vehicles!
                for (int i = 0; i < RandoMath.CachedRandom.Next(1, 4); i++)
                {
                    PotentialGangVehicle newVeh = PotentialGangVehicle.GetCarFromPool();
                    if (newVeh != null)
                    {
                        this.watchedGang.AddGangCar(newVeh);
                    }
                }
            }
        }