Ejemplo n.º 1
0
 public ActiveVehicle(Vehicle vehicle, bool playerVehicle = false, LightStage lightStage = LightStage.Off, SirenStage sirenStage = SirenStage.Off)
 {
     Vehicle            = vehicle;
     VehicleHash        = 0;
     LightStage         = lightStage;
     SirenStage         = sirenStage;
     CurrentHash        = 0;
     TAStage            = TAStage.Off;
     TempUsed           = false;
     TempLightStage     = LightStage.Off;
     TempWailLightStage = LightStage.Off;
     AuxOn                 = false;
     AuxID                 = 999;
     HornID                = 999;
     SoundId               = 999;
     PlayerVehicle         = false;
     SBOn                  = false;
     IntLightOn            = false;
     IndStatus             = IndStatus.Off;
     TAType                = "off";
     TAgroup               = null;
     TApatternCurrentIndex = 999;
     PlayerVehicle         = playerVehicle;
     DefaultEL             = vehicle.EmergencyLighting;
     IsSirenSilent         = vehicle.IsSirenSilent;
     IsScanOn              = false;
     if (vehicle && vehicle.GetDLS() != null)
     {
         bool temp = vehicle.IsSirenOn;
         vehicle.IsSirenOn = false;
         InitialLengths    = new float[20];
         GameFiber.Yield();
         for (int i = 0; i < InitialLengths.Length; i++)
         {
             string bone = "siren" + (i + 1);
             if (vehicle.HasBone(bone))
             {
                 InitialLengths[i] = vehicle.GetBoneOrientation(bone).LengthSquared();
             }
             else
             {
                 InitialLengths[i] = 1f;
             }
         }
         vehicle.IsSirenOn = temp;
         DLSModel vehDLS;
         if (vehicle)
         {
             vehDLS = vehicle.GetDLS();
         }
         else
         {
             vehDLS = null;
         }
         TAType = vehDLS.TrafficAdvisory.Type;
         if (TAType != "off")
         {
             TAgroup = Entrypoint.tagroups[vehDLS.TrafficAdvisory.TAgroup];
             TApatternCurrentIndex = Entrypoint.tagroups[vehDLS.TrafficAdvisory.TAgroup].GetIndexFromTAPatternName(vehDLS.TrafficAdvisory.DefaultTApattern);
         }
         VehicleHash = Game.GetHashKey(vehDLS.Name);
         vehicle.EmergencyLightingOverride = Vehicles.GetEL(vehicle, this);
     }
 }