Example #1
0
        public StarterHandler(TimeCircuits circuits) : base(circuits)
        {
            _restarter                   = circuits.AudioEngine.Create("bttf1/engine/restart.wav", Presets.ExteriorLoudLoop);
            _restarter.SourceBone        = "engine";
            _restarter.FadeOutMultiplier = 6f;
            _restarter.FadeInMultiplier  = 4f;
            _restarter.MinimumDistance   = 6f;

            timedEventManager = new TimedEventManager();

            TimeCircuits.OnTimeTravelComplete += OnTimeTravelComplete;
        }
        public TCDHandler(TimeCircuits circuits) : base(circuits)
        {
            destinationSlot = new TCDSlot("red", GUI, circuits);
            destinationSlot.SetVisible(false);

            presentSlot = new TCDSlot("green", GUI, circuits);
            presentSlot.SetVisible(false);

            previousSlot = new TCDSlot("yellow", GUI, circuits);
            previousSlot.SetVisible(false);

            beep          = circuits.AudioEngine.Create("general/timeCircuits/beep.wav", Presets.Interior);
            fluxCapacitor = circuits.AudioEngine.Create("general/fluxCapacitor.wav", Presets.InteriorLoop);

            fluxCapacitor.Volume = 0.1f;

            fluxCapacitor.MinimumDistance = 0.5f;
            beep.MinimumDistance          = 0.3f;
            fluxCapacitor.SourceBone      = "flux_capacitor";
            beep.SourceBone = "bttf_tcd_green";

            tickingDiodes    = new AnimateProp(circuits.Delorean, ModelHandler.TickingDiodes, Vector3.Zero, Vector3.Zero);
            tickingDiodesOff = new AnimateProp(circuits.Delorean, ModelHandler.TickingDiodesOff, Vector3.Zero, Vector3.Zero);
            tickingDiodesOff.SpawnProp();

            TimeCircuits.OnTimeCircuitsToggle    += OnTimeCircuitsToggle;
            TimeCircuits.OnDestinationDateChange += OnDestinationDateChange;
            TimeCircuits.OnScaleformPriority     += OnScaleformPriority;

            TimeCircuits.OnTimeTravel         += OnTimeTravel;
            TimeCircuits.OnTimeTravelComplete += OnTimeTravelComplete;

            int _time = 0;

            for (int i = 0; i < 7; i++)
            {
                glitchEvents.Add(0, 0, _time, 0, 0, _time + 499);
                glitchEvents.Last.OnExecute += Blank_OnExecute;

                _time += 500;

                glitchEvents.Add(0, 0, _time, 0, 0, _time + 199);
                glitchEvents.Last.OnExecute += RandomDate_OnExecute;

                _time += 200;

                glitchEvents.Add(0, 0, _time, 0, 0, _time + 499);
                glitchEvents.Last.OnExecute += ErrorDate_OnExecute;

                _time += 500;
            }
        }
        public PrestoLogsHandler(TimeCircuits circuits) : base(circuits)
        {
            ModelHandler.RequestModel(ModelHandler.GreenPrestoLogProp);
            ModelHandler.RequestModel(ModelHandler.YellowPrestoLogProp);
            ModelHandler.RequestModel(ModelHandler.RedPrestoLogProp);

            greenLog = new AnimateProp(Vehicle, ModelHandler.GreenPrestoLogProp, "seat_pside_f");
            greenLog.SpawnProp(greenOffset, logsRotation);

            yellowLog = new AnimateProp(Vehicle, ModelHandler.YellowPrestoLogProp, "seat_pside_f");
            yellowLog.SpawnProp(yellowOffset, logsRotation);

            redLog = new AnimateProp(Vehicle, ModelHandler.RedPrestoLogProp, "seat_pside_f");
            redLog.SpawnProp(redOffset, logsRotation);
        }
        public FluxCapacitorHandler(TimeCircuits circuits) : base(circuits)
        {
            _fluxScaleform    = new ScaleformGui("bttf_flux_scaleform");
            _fluxRenderTarget = new RenderTarget(ModelHandler.FluxModel, "bttf_flux", Vehicle, "flux_capacitor");
            _fluxScaleform.DrawInPauseMenu = true;

            _fluxRenderTarget.OnRenderTargetDraw += () =>
            {
                _fluxScaleform.Render2D(new PointF(0.5f, 0.5f), 1f);
            };
            _fluxRenderTarget.CreateProp();

            TimeCircuits.OnTimeCircuitsToggle += OnTimeCircuitsToggle;
            TimeCircuits.OnScaleformPriority  += OnScaleformPriority;
        }
        public MrFusionRefillPlayer(TimeCircuits circuits)
        {
            Circuits = circuits;

            _mrFusion = new AnimateProp(Circuits.Vehicle, ModelHandler.RequestModel(ModelHandler.BTTFMrFusion), "mr_fusion");
            _mrFusion.SpawnProp();

            _mrFusionHandle = new AnimateProp(Circuits.Vehicle, ModelHandler.RequestModel(ModelHandler.BTTFMrFusionHandle), "mr_fusion_handle");
            _mrFusionHandle.SpawnProp();

            _mrfusionOpen   = circuits.AudioEngine.Create("general/mrfusionOpen.wav", Presets.Exterior);
            _mrfusionClosed = circuits.AudioEngine.Create("general/mrfusionClose.wav", Presets.Exterior);

            _mrfusionOpen.Volume   = 0.4f;
            _mrfusionClosed.Volume = 0.4f;
        }
        public SoundHandler(TimeCircuits circuits) : base(circuits)
        {
            _doorOpenSound      = circuits.AudioEngine.Create("general/doorOpen.wav", Presets.Exterior);
            _doorCloseSound     = circuits.AudioEngine.Create("general/doorClose.wav", Presets.Exterior);
            _doorOpenColdSound  = circuits.AudioEngine.Create("general/doorOpenCold.wav", Presets.Exterior);
            _doorCloseColdsound = circuits.AudioEngine.Create("general/doorCloseCold.wav", Presets.Exterior);
            _engineOffsound     = circuits.AudioEngine.Create("general/engine/engineStop.wav", Presets.Exterior);
            _engineOnSound      = circuits.AudioEngine.Create("general/engine/engineStart.wav", Presets.Exterior);

            _engineOffsound.SourceBone = "engine";
            _engineOnSound.SourceBone  = "engine";

            _doorSounds = new List <AudioPlayer>
            {
                _doorOpenSound, _doorCloseSound, _doorOpenColdSound, _doorCloseColdsound
            };
        }
Example #7
0
        private void OnReentryComplete()
        {
            Stop();

            _reentryTimer = 0;

            if (Main.PlayerVehicle == Vehicle)
            {
                TimeCircuits.GetHandler <SparksHandler>().StartTimeTravelCooldown();
            }

            if (TimeCircuits.WasOnTracks)
            {
                TimeCircuits.GetHandler <RailroadHandler>().StartDriving(true);
            }
            else
            {
                Vehicle.Velocity = TimeCircuits.Delorean.LastVelocity;

                if (MPHSpeed == 0)
                {
                    MPHSpeed = 88;
                }
            }

            if (!is99)
            {
                IsFueled = false;
            }

            if (!IsOnTracks && Vehicle.Driver == null)
            {
                Vehicle.SteeringAngle       = Utils.Random.NextDouble() >= 0.5f ? 35 : -35;
                Vehicle.IsHandbrakeForcedOn = true;
                Vehicle.Speed = Vehicle.Speed / 2;

                VehicleControl.SetBrake(Vehicle, 1f);
            }

            TimeCircuits.Delorean.IsInTime = false;

            TimeCircuits.GetHandler <FreezeHandler>().StartFreezeHandling(!is99);

            //Function.Call(Hash.SPECIAL_ABILITY_UNLOCK, Main.PlayerPed.Model);
            Function.Call(Hash.ENABLE_SPECIAL_ABILITY, Game.Player, true);
        }
        public TCDSlot(string slotType, TimeCircuitsScaleform scaleform, TimeCircuits circuits)
        {
            SlotType     = slotType;
            ScreenTCD    = scaleform;
            TimeCircuits = circuits;
            Scaleform    = new TCDRowScaleform(slotType);
            RenderTarget = new RenderTarget(new Model("bttf_3d_row_" + slotType), "bttf_tcd_row_" + slotType, circuits.Vehicle, offsets[slotType], new Vector3(355.9951f, 0.04288517f, 352.7451f));
            RenderTarget.CreateProp();
            Scaleform.DrawInPauseMenu = true;

            amProp = new AnimateProp(circuits.Delorean, new Model($"bttf_{slotType}_am"), Vector3.Zero, Vector3.Zero);
            pmProp = new AnimateProp(circuits.Delorean, new Model($"bttf_{slotType}_pm"), Vector3.Zero, Vector3.Zero);

            RenderTarget.OnRenderTargetDraw += OnRenderTargetDraw;

            date = new DateTime();
        }
        private void Strike()
        {
            if (IsOn)
            {
                // Time travel by lightning strike
                _lightningStrike.Play();

                if (Mods.Hook == HookState.On && !IsFlying)
                {
                    TimeCircuits.GetHandler <TimeTravelHandler>().StartTimeTravelling(false, 700);
                    _flashes = 2;
                }
                else
                {
                    TimeCircuits.GetHandler <TimeTravelHandler>().StartTimeTravelling(true, 2000);
                    _flashes = 0;

                    TimeCircuits.SetTimeCircuitsBroken(true);
                }

                DeloreanCopy deloreanCopy = TimeCircuits.Delorean.Copy;
                deloreanCopy.Circuits.DestinationTime = deloreanCopy.Circuits.DestinationTime.AddYears(70);
                RemoteDeloreansHandler.AddDelorean(deloreanCopy);
            }
            else
            {
                Function.Call(Hash.FORCE_LIGHTNING_FLASH);
            }

            if (!IsFlying && !IsOn)
            {
                TimeCircuits.SetTimeCircuitsBroken(true);
            }

            if (IsFlying)
            {
                FlyingCircuitsBroken = true;
            }

            Vehicle.EngineHealth -= 700;

            _hasBeenStruckByLightning = true;
            _nextCheck = Game.GameTime + 60000;
        }
        public InputHandler(TimeCircuits circuits) : base(circuits)
        {
            _inputEnter      = circuits.AudioEngine.Create("general/timeCircuits/tfcEnter.wav", Presets.Interior);
            _inputEnterError = circuits.AudioEngine.Create("general/timeCircuits/tfcError.wav", Presets.Interior);

            _inputEnter.SourceBone      = "bttf_tcd_green";
            _inputEnterError.SourceBone = "bttf_tcd_green";

            _keypadSounds = new Dictionary <int, AudioPlayer>();

            for (int i = 0; i <= 9; i++)
            {
                _keypadSounds[i] = circuits.AudioEngine.Create("general/keypad/" + i + ".wav", Presets.Interior);
            }

            foreach (var keypad in _keypadSounds)
            {
                keypad.Value.Volume     = 0.45f;
                keypad.Value.SourceBone = "bttf_tcd_green";
            }
        }
Example #11
0
        public SparksHandler(TimeCircuits circuits) : base(circuits)
        {
            sparksAudio        = new AudioPlayer($"sparks_{LowerCaseDeloreanType}.wav", false, 0.7f);
            diodesGlowingSound = new AudioPlayer("diodes_glowing.wav", false, 1);

            sparksPtfxs.Add(new PtfxEntityPlayer("des_bigjobdrill", "ent_ray_big_drill_sparks", Vehicle, new Vector3(0, 3f, 0), Vector3.Zero, 3.5f, true, true, 15));
            sparksPtfxs.Add(new PtfxEntityPlayer("scr_paletoscore", "scr_paleto_box_sparks", Vehicle, new Vector3(0, 3f, 0), new Vector3(0, 0, 180), 1.5f, true, true, 300));
            sparksPtfxs.Add(new PtfxEntityPlayer("scr_reconstructionaccident", "sp_sparking_generator", Vehicle, new Vector3(0, 3f, 0), Vector3.Zero, 1.5f, true, true, 400));

            foreach (var wheelName in wheelNames)
            {
                var worldPos = Vehicle.GetBoneCoord(wheelName);
                var offset   = Vehicle.GetOffsetFromWorldCoords(worldPos);

                offset = new Vector3(offset.X, offset.Y - 0.3f, offset.Z - 0.15f);

                var ptfx = new PtfxEntityPlayer("scr_carsteal4", "scr_carsteal5_car_muzzle_flash", Vehicle, offset, new Vector3(0f, 0f, -90f), 1f, true, true, 15);

                wheelPtfxes.Add(ptfx);
            }
        }
Example #12
0
        public static void Randomize(TimeCircuits circuits)
        {
            // Set the weather to a random weather
            World.Weather = Utils.GetRandomWeather();

            // Initial puddle level
            float puddleLevel = 0;

            // If the weather is raining
            if (World.Weather == Weather.Raining)
            {
                // Set the puddle to a random number between 0.4 and 0.8
                puddleLevel = (float)Utils.Random.NextDouble(0.4, 0.8);
            }
            // If the weather is clearing
            else if (World.Weather == Weather.Clearing)
            {
                // Set the puddle to 0.2
                puddleLevel = 0.2f;
            }
            // If the weather is a thunderstorm
            else if (World.Weather == Weather.ThunderStorm)
            {
                // Set the puddle to 0.9f
                puddleLevel = 0.9f;
            }

            // Apply the puddle level
            RainPuddleEditor.Level = puddleLevel;

            // Reset wanted level
            Game.Player.WantedLevel = 0;

            // Delete nearby Vehicles
            var nearbyVehicles = World.GetNearbyVehicles(circuits.Vehicle.Position, 50f).ToList();

            nearbyVehicles
            .Where(x => !x.IsTimeMachine() && !vehiclesEnteredByPlayer.Contains(x)).ToList()
            .ForEach(x => x.DeleteCompletely());
        }
Example #13
0
        public static void TimeTravelTo(TimeCircuits timeCircuits, DateTime time)
        {
            // Try to find a stored moment for our time jump
            var moment = GetStoredMoment(time, 6);

            if (moment != null)
            {
                // We found a moment.
                // Apply it.
                ApplyMoment(moment);

                UI.ShowSubtitle("Found: " + World.Weather + " Puddle Level: " + RainPuddleEditor.Level);
            }
            else
            {
                // Get the current Moment object for current situation.
                moment = GetMomentForNow();

                // Clear the entered vehicles list
                vehiclesEnteredByPlayer.Clear();

                // We didn't find a moment.
                // Randomise.
                Randomize(timeCircuits);

                UI.ShowSubtitle("Randomizin: " + World.Weather + " Puddle Level: " + RainPuddleEditor.Level);

                // Add to stored Moments list.
                momentsInTime.Add(moment);
            }

            // Set previous time
            timeCircuits.PreviousTime = Utils.GetWorldTime();

            // Set the new GTA time.
            Utils.SetWorldTime(time);

            // Set the era
            TrafficInjector.UpdateEra();
        }
        public FlyingHandler(TimeCircuits circuits) : base(circuits)
        {
            if (Mods.HoverUnderbody == ModState.On)
            {
                LoadWheelAnim();
            }

            _flyOn      = circuits.AudioEngine.Create("bttf2/hover/toHover.wav", Presets.Exterior);
            _flyOff     = circuits.AudioEngine.Create("bttf2/hover/toRegular.wav", Presets.Exterior);
            _upSound    = circuits.AudioEngine.Create("bttf2/hover/hoverUp.wav", Presets.Exterior);
            _boostSound = circuits.AudioEngine.Create("bttf2/hover/boost.wav", Presets.Exterior);

            foreach (var wheelPos in Utils.GetWheelPositions(Vehicle))
            {
                var ptfx = new PtfxEntityPlayer("cut_trevor1", "cs_meth_pipe_smoke", Vehicle, wheelPos.Value, new Vector3(-90, 0, 0), 7f);
                _smokeParticles.Add(ptfx);
            }

            for (int i = 1; i < 6; i++)
            {
                if (!ModelHandler.UnderbodyLights.TryGetValue(i, out var model))
                {
                    continue;
                }

                ModelHandler.RequestModel(model);
                var prop = new AnimateProp(Vehicle, model, Vector3.Zero, Vector3.Zero);
                _underbodyLights.Add(prop);
            }

            _flyModeInput = new NativeInput((GTA.Control) 357);
            _flyModeInput.OnControlLongPressed += OnFlyModeControlJustPressed;

            _hoverGlowing = new AnimateProp(Vehicle, ModelHandler.RequestModel(ModelHandler.HoverGlowing), Vector3.Zero, Vector3.Zero)
            {
                Duration = 1.7f
            };

            ventGlowing = new AnimateProp(Vehicle, ModelHandler.RequestModel(ModelHandler.VentGlowing), Vector3.Zero, Vector3.Zero);
        }
        public static void SetupJump(TimeCircuits timeCircuits, DateTime time)
        {
            Utils.DeleteNearbyVehPed();

            // Try to find a stored moment for our time jump
            var moment = GetStoredMoment(time, 6);

            if (moment != null)
            {
                // We found a moment.
                // Apply it.
                ApplyMoment(moment);
            }
            else
            {
                // Get the current Moment object for current situation.
                var currentMoment = GetMomentForNow();

                // Clear the entered vehicles list
                vehiclesEnteredByPlayer.Clear();

                // We didn't find a moment.
                // Randomise.
                Randomize(timeCircuits);

                // Get the moment AFTER randomizing
                var newMoment = GetMomentForNow();
                newMoment.CurrentDate = timeCircuits.DestinationTime;

                // Add both moments to stored Moments list.
                momentsInTime.Add(moment);
                momentsInTime.Add(newMoment);
            }

            DeloreanHandler.ExistenceCheck(time);

            RemoteDeloreansHandler.ExistenceCheck(time);

            RogersSierra.Manager.RogersSierra?.Delete();
        }
Example #16
0
        public RcHandler(TimeCircuits circuits) : base(circuits)
        {
            PlayerSwitch.OnSwitchingComplete += OnSwitchingComplete;

            rcOn           = circuits.AudioEngine.Create("general/rc/on.wav", Presets.Exterior);
            rcOff          = circuits.AudioEngine.Create("general/rc/off.wav", Presets.Exterior);
            rcBrake        = circuits.AudioEngine.Create("general/rc/brake.wav", Presets.Exterior);
            rcAcceleration = circuits.AudioEngine.Create("general/rc/acceleration.wav", Presets.Exterior);
            rcSomeSerious  = circuits.AudioEngine.Create("general/rc/someSerious.wav", Presets.Exterior);

            _rcSounds = new List <AudioPlayer>
            {
                rcOn, rcOff, rcBrake, rcAcceleration, rcSomeSerious
            };

            foreach (var sound in _rcSounds)
            {
                sound.Volume          = 0.4f;
                sound.MinimumDistance = 1f;
            }

            rcHandbrake = new NativeInput(GTA.Control.VehicleHandbrake);
            rcHandbrake.OnControlJustPressed += RcHandbrake_OnControlJustPressed;
        }
 public TimeTravelHandler(TimeCircuits circuits) : base(circuits)
 {
     timeTravelAudio = new AudioPlayer($"{LowerCaseCurrentMode}_timetravel_{LowerCaseDeloreanType}.wav", false, 1.2f);
 }
Example #18
0
 public PhotoHandler(TimeCircuits circuits) : base(circuits)
 {
     _coilsProp = new AnimateProp(TimeCircuits.Vehicle, ModelHandler.CoilsGlowing, Vector3.Zero, Vector3.Zero);
 }
Example #19
0
        public WormholeAnimationPlayer(TimeCircuits circuits, int maxTime = 4350)
        {
            _wheelPtfxes = new List <PtfxEntityPlayer>();

            TimeCircuits = circuits;
            MaxTime      = maxTime;

            string wormholeScaleformName    = "bttf_wormhole_scaleform"; // default
            string wormholeRenderTargetName = "bttf_wormhole";           // default

            switch (circuits.DeloreanType)
            {
            case DeloreanType.BTTF1:

                SetupWheelPTFXs("veh_xs_vehicle_mods", "veh_nitrous", new Vector3(0, -0.25f, -0.15f), new Vector3(0, 0, 0), 1.3f);

                _wormholeModel           = ModelHandler.WormholeViolet;
                _wormholeNightModel      = ModelHandler.WormholeVioletNight;
                _sparkModel              = ModelHandler.SparkModel;
                _sparkNightModel         = ModelHandler.SparkNightModel;
                wormholeScaleformName    = "bttf_wormhole_scaleform";
                wormholeRenderTargetName = "bttf_wormhole";
                break;

            case DeloreanType.BTTF2:

                _wormholeModel           = ModelHandler.WormholeBlue;
                _wormholeNightModel      = ModelHandler.WormholeBlueNight;
                _sparkModel              = ModelHandler.SparkModel;
                _sparkNightModel         = ModelHandler.SparkNightModel;
                wormholeScaleformName    = "bttf_wormhole_scaleform_blue";
                wormholeRenderTargetName = "bttf_wormhole_blue";
                break;

            case DeloreanType.BTTF3:

                SetupWheelPTFXs("veh_xs_vehicle_mods", "veh_nitrous", new Vector3(0, -0.25f, -0.15f), new Vector3(0, 0, 0), 1.3f);
                SetupWheelPTFXs("des_bigjobdrill", "ent_ray_big_drill_start_sparks", new Vector3(0, 0, 0.18f), new Vector3(90f, 0, 0), 1f, true);

                _sparkProp = new AnimateProp(TimeCircuits.Vehicle, ModelHandler.InvisibleProp, new Vector3(0, 3.4f, -0.6f), new Vector3(0, 0, 180));
                _sparkProp.SpawnProp();

                _sparkPTFX = new PtfxEntityPlayer("scr_paletoscore", "scr_paleto_box_sparks", _sparkProp.Prop, Vector3.Zero, Vector3.Zero, 1.5f, true, true, 300);

                //_sparkPTFX = new PtfxEntityPlayer("scr_paletoscore", "scr_paleto_box_sparks", TimeCircuits.Vehicle, new Vector3(0, 3.4f, -0.6f), new Vector3(0, 0, 180), 1.5f, true, true, 300);
                //_sparkPTFX = new PtfxEntityBonePlayer("scr_reconstructionaccident", "scr_sparking_generator", TimeCircuits.Vehicle, "bonnet", new Vector3(0,-0.2f,0.2f), Vector3.Zero, 4f, true);

                //_sparkPTFX = new List<PtfxEntityBonePlayer>();

                //_sparkPTFX.Add(new PtfxEntityBonePlayer("core", "ent_amb_sparking_wires", TimeCircuits.Vehicle, "bonnet", new Vector3(-0.2f, -0.2f, 0.2f), new Vector3(0, -90, 0), 2f, true));
                //_sparkPTFX.Add(new PtfxEntityBonePlayer("core", "ent_amb_sparking_wires", TimeCircuits.Vehicle, "bonnet", new Vector3(0, -0.2f, 0.2f), new Vector3(0, 0, 0), 2f, true));
                //_sparkPTFX.Add(new PtfxEntityBonePlayer("core", "ent_amb_sparking_wires", TimeCircuits.Vehicle, "bonnet", new Vector3(0.2f, -0.2f, 0.2f), new Vector3(0, 90, 0), 2f, true));

                _wormholeModel           = ModelHandler.WormholeRed;
                _wormholeNightModel      = ModelHandler.WormholeRedNight;
                _sparkModel              = ModelHandler.SparkRedModel;
                _sparkNightModel         = ModelHandler.SparkRedNightModel;
                wormholeScaleformName    = "bttf_wormhole_scaleform_red";
                wormholeRenderTargetName = "bttf_wormhole_red";
                break;
            }

            _wormholeRT                        = new RenderTarget(_wormholeModel, wormholeRenderTargetName, TimeCircuits.Vehicle, "bttf_wormhole");
            _wormholeScaleform                 = new ScaleformGui(wormholeScaleformName);
            _wormholeRT.OnRenderTargetDraw    += OnRenderTargetDraw;
            _wormholeScaleform.DrawInPauseMenu = true;

            _coilsProp = new AnimateProp(TimeCircuits.Vehicle, ModelHandler.CoilsGlowing, Vector3.Zero, Vector3.Zero);

            _sparks = new List <SparkPlayer>();
            foreach (List <Vector3> sparks in Constants.SparkOffsets)
            {
                _sparks.Add(new SparkPlayer(TimeCircuits.Vehicle, sparks, _sparkModel));
            }
        }
        public FuelHandler(TimeCircuits circuits) : base(circuits)
        {
            LoadRes();

            SetEmpty(false);
        }
Example #21
0
 public FireTrailsHandler(TimeCircuits circuits) : base(circuits)
 {
 }
Example #22
0
 public RCHandler(TimeCircuits circuits) : base(circuits)
 {
 }
Example #23
0
        public static void AddToTimeTravelledList(TimeCircuits circuits)
        {
            var del = circuits.Delorean.CreateCopy(true);

            timeTravelledDeloreans.Add(del.Circuits, Game.GameTime + 3000);
        }
Example #24
0
        public override void Process()
        {
            coldAudio?.Process();
            ventAudio?.Process();

            if (Vehicle.DirtLevel != 0)
            {
                Vehicle.DirtLevel = Utils.Lerp(Vehicle.DirtLevel, 0, Game.LastFrameTime * 0.1f);
                if (Vehicle.DirtLevel < 1)
                {
                    Vehicle.DirtLevel = 0;
                }
            }

            if (Vehicle == null)
            {
                return;
            }
            if (!isFreezing)
            {
                return;
            }
            if (Game.GameTime < gameTimer)
            {
                return;
            }

            switch (currentStep)
            {
            case 0:
                Vehicle.DirtLevel = 12;

                gameTimer = Game.GameTime + 2000;
                currentStep++;
                break;

            case 1:

                coldAudio.Play(Vehicle);
                gameTimer = Game.GameTime + 15000;
                currentStep++;
                break;

            case 2:

                if (DeloreanType == DeloreanType.BTTF)
                {
                    ventAudio.Play(Vehicle);
                    currentStep++;
                    gameTimer = Game.GameTime + 1000;
                }
                else
                {
                    currentStep = 4;
                    gameTimer   = Game.GameTime + 5000;
                }
                break;

            case 3:
                for (; smokeIndex < 7;)
                {
                    rightSmokePtfx.Play(true);
                    leftSmokePtfx.Play(true);

                    gameTimer = Game.GameTime + 500;

                    smokeIndex++;

                    return;
                }

                currentStep++;
                gameTimer = Game.GameTime + 1000;
                break;

            case 4:

                TimeCircuits.GetHandler <FuelHandler>().UpdateFuel();
                Stop();
                break;
            }
        }
Example #25
0
 public FuelHandler(TimeCircuits circuits) : base(circuits)
 {
     emptySound  = new AudioPlayer("empty.wav", false);
     refuelSound = new AudioPlayer("refuel.wav", false);
 }
 public Hydraulic(TimeCircuits circuits) : base(circuits)
 {
 }
        public override void Process()
        {
            if (!IsFreezing)
            {
                Function.Call <float>(Hash.SET_VEHICLE_ENVEFF_SCALE, Vehicle, 0f);
                return;
            }

            if (!Vehicle.IsVisible)
            {
                Stop();
            }

            // 0 is no ice
            var iceScale = Function.Call <float>(Hash.GET_VEHICLE_ENVEFF_SCALE, Vehicle);

            if (iceScale > 0f)
            {
                float newIce = Utils.Lerp(_iceMaxVal, 0f, _iceDisappearVal / _timeToDisappear);

                if (newIce <= 0.15f)
                {
                    _iceSmoke?.StopNaturally();

                    foreach (var waterDrop in _waterDrops)
                    {
                        waterDrop?.StopNaturally();
                    }

                    _coldAudio.Stop();
                    IcePlaying = false;
                }

                Function.Call <float>(Hash.SET_VEHICLE_ENVEFF_SCALE, Vehicle, newIce);

                _iceDisappearVal += Game.LastFrameTime;
            }
            else
            {
                IsFreezing = false;
                Stop();
            }

            if (!_doingFreezingSequence)
            {
                return;
            }

            if (Game.GameTime < _gameTimer)
            {
                return;
            }

            switch (_currentStep)
            {
            case 0:
                // Set the ice
                Function.Call(Hash.SET_VEHICLE_ENVEFF_SCALE, Vehicle, _iceMaxVal);

                if (Mods.Reactor == ReactorType.Nuclear)
                {
                    // Spawn the ice particles
                    _iceSmoke?.Play();

                    foreach (var waterDrop in _waterDrops)
                    {
                        UpdateDoorIce(waterDrop.BoneName.Contains("left")
                                ? VehicleDoorIndex.FrontLeftDoor
                                : VehicleDoorIndex.FrontRightDoor, waterDrop);
                    }

                    _coldAudio.Play();
                    IcePlaying = true;
                }

                _gameTimer = Game.GameTime + 2000;
                _currentStep++;
                break;

            case 1:
                _gameTimer = Game.GameTime + 15000;
                _currentStep++;
                break;

            case 2:
                if (Mods.Reactor == ReactorType.Nuclear)
                {
                    _ventAudio.Play();
                }

                _currentStep++;
                _gameTimer = Game.GameTime + 1000;
                break;

            case 3:
                if (Mods.Reactor == ReactorType.Nuclear)
                {
                    for (; _smokeIndex < 7;)
                    {
                        _rightSmokePtfx.Play();
                        _leftSmokePtfx.Play();

                        _gameTimer = Game.GameTime + 500;

                        _smokeIndex++;

                        return;
                    }
                }

                _currentStep++;
                _gameTimer = Game.GameTime + 1000;
                break;

            case 4:

                if (_fuelNotif)
                {
                    TimeCircuits.GetHandler <FuelHandler>().BlinkFuel();
                }

                _doingFreezingSequence = false;
                break;
            }
        }
Example #28
0
 public TimeCircuitsInfo(TimeCircuits circuits)
 {
     Circuits = circuits;
 }
 public HookHandler(TimeCircuits circuits) : base(circuits)
 {
 }
        public override void Process()
        {
            timeTravelAudio?.Process();

            if (Vehicle == null)
            {
                return;
            }
            if (!isTimeTravelling)
            {
                return;
            }
            if (Game.GameTime < gameTimer)
            {
                return;
            }

            switch (currentStep)
            {
            case 0:
                timeTravelAudio.Play(Vehicle);

                // If the current Time Travel mode is Instant
                if (CurrentMode != TimeTravelMode.CutScene)
                {
                    // Have to call SetupJump manually here.
                    TimeHandler.TimeTravelTo(TimeCircuits, DestinationTime);

                    // Set MPHSpeed
                    MPHSpeed = 65;

                    // Stop handling
                    Stop();
                    return;
                }

                TimeCircuits.GetHandler <FireTrailsHandler>().SpawnFireTrails();

                Utils.HideVehicle(Vehicle, true);

                // If the Vehicle is remote controlled or the player is not the one in the driver seat
                if (IsRemoteControlled || Vehicle.GetPedOnSeat(VehicleSeat.Driver) != Game.Player.Character)
                {
                    // Stop remote controlling
                    TimeCircuits.GetHandler <RCHandler>().StopRC();

                    // Add to time travelled list
                    TimeHandler.AddToTimeTravelledList(TimeCircuits);

                    // Reset currentStep + other fields.
                    ResetFields();
                    return;
                }

                gameTimer = Game.GameTime + 4000;

                currentStep++;
                break;

            case 1:
                Game.FadeScreenOut(1000);
                gameTimer = Game.GameTime + 1500;

                currentStep++;
                break;

            case 2:
                TimeHandler.TimeTravelTo(TimeCircuits, DestinationTime);
                TimeCircuits.GetHandler <FireTrailsHandler>().Stop();
                gameTimer = Game.GameTime + 1000;

                currentStep++;
                break;

            case 3:
                Game.FadeScreenIn(1000);
                gameTimer = Game.GameTime + 2000;

                currentStep++;
                break;

            case 4:
                Reenter();
                TimeHandler.AddToTimeTravelledList(TimeCircuits);

                ResetFields();
                break;
            }
        }