예제 #1
0
        private static void Update()
        {
            if (Core.Utility.IsPauseMenuActive)
            {
                // with ShouldTickInPauseMenu set the spotlight is still visible in the pause menu
                // without needing to do anything else, so if the pause menu is active don't do anything
                return;
            }

            while (PluginState.HasAnySpotlightRequest())
            {
                Vehicle v = PluginState.PopSpotlightRequest();
                if (v)
                {
                    GetVehicleSpotlight(v);
                }
            }

            if (InputControllers.Any(c => c.ShouldToggleSpotlight()))
            {
                VehicleSpotlight s = GetPlayerCurrentVehicleSpotlight();

                if (s != null)
                {
                    s.IsActive = !s.IsActive;
                }
            }

            for (int i = Spotlights.Count - 1; i >= 0; i--)
            {
                VehicleSpotlight s = Spotlights[i];
                if (!s.Vehicle || s.Vehicle.IsDead)
                {
                    s.IsActive = false;
                    s.OnRemoved();
                    Spotlights.RemoveAt(i);
                    continue;
                }

                s.Update(InputControllers);
            }


            if ((Editor == null || !Editor.Window.IsVisible) && Game.IsKeyDown(Settings.EditorKey))
            {
                if (Editor != null)
                {
                    Editor?.Window?.Close();
                    Editor = null;
                }

                Editor = new EditorForm();
                Editor.Show();
                Editor.Position = new System.Drawing.Point(300, 300);
            }
        }
예제 #2
0
 public void Use(VehicleSpotlight spotlight)
 {
     SlotStatus     = Status.Used;
     HasChanged     = false;
     IsActive       = spotlight.IsActive;
     IsInSearchMode = spotlight.IsInSearchMode;
     VehicleHandle  = spotlight.Vehicle.Handle;
     TrackedEntity  = spotlight.TrackedEntity;
     Rotation       = spotlight.RelativeRotation;
     Position       = spotlight.Position;
 }
예제 #3
0
        private static VehicleSpotlight GetVehicleSpotlight(Vehicle vehicle)
        {
            VehicleSpotlight s = Spotlights.FirstOrDefault(l => l.Vehicle == vehicle);

            if (s != null)
            {
                return(s);
            }

            s = new VehicleSpotlight(vehicle);
            Spotlights.Add(s);
            return(s);
        }
예제 #4
0
        private static void Update()
        {
            if (SpotlightInputControllers.Any(c => c.ShouldToggleSpotlight()))
            {
                VehicleSpotlight s = GetPlayerCurrentVehicleSpotlight();

                if (s != null)
                {
                    s.IsActive = !s.IsActive;
                }
            }


            for (int i = Spotlights.Count - 1; i >= 0; i--)
            {
                VehicleSpotlight s = Spotlights[i];
                if (!s.Vehicle || s.Vehicle.IsDead)
                {
                    s.IsActive = false;
                    Spotlights.RemoveAt(i);
                    continue;
                }

                s.Update(SpotlightInputControllers);
            }

            if ((Editor == null || !Editor.Window.IsVisible) && Game.IsKeyDown(Settings.EditorKey))
            {
                if (Editor != null)
                {
                    Editor?.Window?.Close();
                    Editor = null;
                }

                Editor = new EditorForm();
                Editor.Show();
                Editor.Position = new System.Drawing.Point(300, 300);
            }
        }