Exemplo n.º 1
0
 public StrobedLight(StrobedVehicle vehicle, VehicleLight light)
 {
     StrobedVehicle = vehicle;
     Light = light;
     lightOffset = GetLightOffsetFor(vehicle.Vehicle, light);
 }
Exemplo n.º 2
0
 public StrobedLight(StrobedVehicle vehicle, VehicleLight light)
 {
     StrobedVehicle = vehicle;
     Light          = light;
     lightOffset    = GetLightOffsetFor(vehicle.Vehicle, light);
 }
Exemplo n.º 3
0
        private static void Main()
        {
            while (Game.IsLoading)
            {
                GameFiber.Sleep(250);
            }

            while (true)
            {
                GameFiber.Yield();

                GameTime  = Game.GameTime;
                playerPed = Game.LocalPlayer.Character;
                playerPos = playerPed.Position;

                if (Settings.AIEnabled)
                {
                    if ((DateTime.UtcNow - lastVehiclesCheckTime).TotalSeconds > 1.5)
                    {
                        Entity[] vehs = World.GetEntities(playerPos, ActionRadius, GetEntitiesFlags.ConsiderAllVehicles);

                        for (int i = 0; i < vehs.Length; i++)
                        {
                            Vehicle v = (Vehicle)vehs[i];
                            if (CanBeStrobedVehicle(v))
                            {
                                StrobedVehicles.Add(new StrobedVehicle(v, Settings.Patterns[Random.Next(Settings.Patterns.Length)]));
                            }
                        }
                        lastVehiclesCheckTime = DateTime.UtcNow;
                    }


                    for (int i = StrobedVehicles.Count - 1; i >= 0; i--)
                    {
                        StrobedVehicle v = StrobedVehicles[i];
                        if (v == null || !v.Vehicle || v.Vehicle == playerPed.CurrentVehicle || Vector3.DistanceSquared(v.Vehicle.Position, playerPos) > ActionRadiusSqr)
                        {
                            if (v != null)
                            {
                                v.Dispose();
                            }
                            StrobedVehicles.RemoveAt(i);
                            continue;
                        }

                        v.Update();
                    }
                }


                if (Settings.PlayerEnabled)
                {
                    if (PlayerStrobedVehicle == null)
                    {
                        TryCreatePlayerStrobedVehicle();
                    }
                    else if (!PlayerStrobedVehicle.Vehicle)
                    {
                        PlayerStrobedVehicle.Dispose();
                        PlayerStrobedVehicle = null;
                    }
                    else if (playerPed.IsInAnyVehicle(false) && PlayerStrobedVehicle.Vehicle != playerPed.CurrentVehicle)
                    {
                        PlayerStrobedVehicle.Dispose();
                        PlayerStrobedVehicle = null;
                        TryCreatePlayerStrobedVehicle();
                    }

                    PlayerStrobedVehicle?.Update();
                }
            }
        }