Ejemplo n.º 1
0
 public void SetInstant()
 {
     _alphaLevel = 52f;
     _state      = true;
     LoadLights(true);
     _hoodboxLights.SpawnProp();
     _hoodboxLights.Prop.Opacity = (int)_alphaLevel;
 }
Ejemplo n.º 2
0
        public void UpdateSparkModel(Model model)
        {
            _spark.Model = model;

            if (_spark.IsSpawned)
            {
                _spark.SpawnProp();
            }
        }
Ejemplo n.º 3
0
        public DeloreanManager(Vehicle vehicle)
        {
            Vehicle = vehicle;

            rpmNeedle     = new AnimateProp(Vehicle, "dmc12_rpm_needle", "rpm_needle");
            speedNeedle   = new AnimateProp(Vehicle, "dmc12_speed_needle", "speed_needle");
            fuelNeedle    = new AnimateProp(Vehicle, "dmc12_fuel_needle", "fuel_needle");
            tempNeedle    = new AnimateProp(Vehicle, "dmc12_temperature_needle", "temperature_needle");
            oilNeedle     = new AnimateProp(Vehicle, "dmc12_oil_needle", "oil_needle");
            voltNeedle    = new AnimateProp(Vehicle, "dmc12_voltage_needle", "voltage_needle");
            doorIndicator = new AnimateProp(Vehicle, "dmc12_door_indicator", Vector3.Zero, Vector3.Zero);
            leftFan       = new AnimateProp(Vehicle, ModelHandler.RadiatorFan, "radiator_fan_l");
            rightFan      = new AnimateProp(Vehicle, ModelHandler.RadiatorFan, "radiator_fan_r");

            suspensionLeftFront  = new AnimateProp(Vehicle, ModelHandler.SuspensionFront, "suspension_lf");
            suspensionLeftRear   = new AnimateProp(Vehicle, ModelHandler.SuspensionRear, "suspension_lr");
            suspensionRightFront = new AnimateProp(Vehicle, ModelHandler.SuspensionRightFront, "suspension_rf");
            suspensionRightRear  = new AnimateProp(Vehicle, ModelHandler.SuspensionRightRear, "suspension_rr");

            rpmNeedle.SpawnProp();
            speedNeedle.SpawnProp();
            fuelNeedle.SpawnProp();
            tempNeedle.SpawnProp();
            oilNeedle.SpawnProp();
            voltNeedle.SpawnProp();
            doorIndicator.SpawnProp();
            leftFan.SpawnProp();
            rightFan.SpawnProp();

            suspensionLeftFront.SpawnProp();
            suspensionLeftRear.SpawnProp();
            suspensionRightFront.SpawnProp();
            suspensionRightRear.SpawnProp();
        }
        public PlutoniumRefillPlayer(TimeCircuits circuits)
        {
            Circuits = circuits;

            plutoniumCap = new AnimateProp(Circuits.Vehicle, ModelHandler.RequestModel(ModelHandler.BTTFReactorCap), "bttf_reactorcap");
            plutoniumCap.SpawnProp();
        }
        public override void Process()
        {
            if (!IsPlaying)
            {
                return;
            }

            switch (currentStep)
            {
            case 0:
                if (open)
                {
                    float rotationToAdd = (90f * Game.LastFrameTime) / 0.75f;
                    currentRotation -= rotationToAdd;

                    if (currentRotation <= -90)
                    {
                        currentStep++;
                    }
                }
                else
                {
                    float offsetToSub = (0.06f * Game.LastFrameTime) / 0.75f;
                    currentOffset -= offsetToSub;

                    if (currentOffset <= 0)
                    {
                        currentStep++;
                    }
                }

                break;

            case 1:
                if (open)
                {
                    float offsetToAdd = (0.06f * Game.LastFrameTime) / 0.75f;
                    currentOffset += offsetToAdd;

                    if (currentOffset >= 0.06f)
                    {
                        Stop();
                    }
                }
                else
                {
                    float rotationToSub = (90f * Game.LastFrameTime) / 0.75f;
                    currentRotation += rotationToSub;

                    if (currentRotation >= 0)
                    {
                        Stop();
                    }
                }

                break;
            }

            plutoniumCap.SpawnProp(new Vector3(0, 0, currentOffset), new Vector3(0, 0, currentRotation), false);
        }
        public override void Process()
        {
            if (Vehicle.AreLightsOn && Vehicle.IsEngineRunning)
            {
                if (!_leftIndicatorProp.IsSpawned && !Vehicle.IsLeftHeadLightBroken)
                {
                    _leftIndicatorProp.SpawnProp();
                }

                if (!_rightIndicatorProp.IsSpawned && !Vehicle.IsRightHeadLightBroken)
                {
                    _rightIndicatorProp.SpawnProp();
                }
            }
            else
            {
                _leftIndicatorProp.DeleteProp();
                _rightIndicatorProp.DeleteProp();

                return;
            }

            if (Vehicle.IsLeftHeadLightBroken && _leftIndicatorProp.IsSpawned)
            {
                _leftIndicatorProp.DeleteProp();
            }

            if (Vehicle.IsRightHeadLightBroken && _rightIndicatorProp.IsSpawned)
            {
                _rightIndicatorProp.DeleteProp();
            }
        }
Ejemplo n.º 7
0
        public SpeedoHandler(TimeCircuits circuits) : base(circuits)
        {
            //speedoProp = new AnimateProp(Vehicle, ModelHandler.BTTFSpeedo, new Vector3(-0.2543122f, 0.3725779f, 0.7174588f), Vector3.Zero);
            _compass           = new AnimateProp(Vehicle, ModelHandler.Compass, "bttf_compass");
            speedoProp         = new AnimateProp(Vehicle, ModelHandler.BTTFSpeedo, "bttf_speedo");
            _speedoRt          = new RenderTarget(ModelHandler.BTTFSpeedo, "bttf_speedo");
            _speedoRtScaleform = new ScaleformGui("bttf_3d_speedo")
            {
                DrawInPauseMenu = true
            };

            _speedBeep                 = circuits.AudioEngine.Create("general/speedoTick.wav", Presets.Interior);
            _speedBeep.Volume          = 1f;
            _speedBeep.MinimumDistance = 0.3f;
            _speedBeep.SourceBone      = "bttf_speedo";

            _speedoRt.OnRenderTargetDraw += () =>
            {
                var aspectRatio = Screen.Resolution.Width / (float)Screen.Resolution.Height;

                _speedoRtScaleform.Render2D(new PointF(0.5f, 0.5f), new SizeF(0.9f, 0.9f));
            };

            speedoProp.SpawnProp();

            UpdateGUI(GUI, "8", "8");
        }
Ejemplo n.º 8
0
        public TFCHandler(TimeCircuits circuits) : base(circuits)
        {
            tfcOn = new AnimateProp(Vehicle, ModelHandler.TFCOn, Vector3.Zero, Vector3.Zero);
            tfcOff = new AnimateProp(Vehicle, ModelHandler.TFCOff, Vector3.Zero, Vector3.Zero);
            tfcHandle = new AnimateProp(Vehicle, ModelHandler.TFCHandle, new Vector3(-0.03805999f, -0.0819466f, 0.5508024f), Vector3.Zero);
            tfcHandle.SpawnProp(false);

            TimeCircuits.OnTimeCircuitsToggle += OnTimeCircuitsToggle;
        }   
Ejemplo n.º 9
0
        public override void Process()
        {
            _compass?.SpawnProp(Vector3.Zero, new Vector3(0, 0, Vehicle.Heading), false);

            if (_compass.Prop.IsVisible != Vehicle.IsVisible)
            {
                _compass.Prop.IsVisible = Vehicle.IsVisible;
            }
        }
Ejemplo n.º 10
0
        public override void Process()
        {
            if (!TimeCircuits.Delorean.IsGivenScaleformPriority || Main.PlayerPed.Position.DistanceToSquared(Vehicle.Position) > 6f * 6f)
            {
                return;
            }

            _compass?.SpawnProp(Vector3.Zero, new Vector3(0, 0, Vehicle.Heading), false);

            if (_compass.Prop.IsVisible != Vehicle.IsVisible)
            {
                _compass.Prop.IsVisible = Vehicle.IsVisible;
            }

            _speedoRt.Draw();

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

            if (!(TimeCircuits.IsReentering || TimeCircuits.IsTimeTraveling))
            {
                int mphSpeed = ((int)MPHSpeed);

                if (mphSpeed > 88)
                {
                    mphSpeed = 88;
                }

                string mphSpeedStr = mphSpeed.ToString("00");

                string speedDigit1 = mphSpeedStr.Substring(0, 1);
                string speedDigit2 = mphSpeedStr.Substring(1, 1);

                if (mphSpeed > currentSpeed || mphSpeed < currentSpeed)
                {
                    currentSpeed = mphSpeed;

                    if (ModSettings.PlaySpeedoBeep && Vehicle.IsVisible)
                    {
                        _speedBeep.Play();
                    }

                    UpdateGUI(_speedoRtScaleform, speedDigit1, speedDigit2);

                    if (!TcdEditer.IsEditing)
                    {
                        UpdateGUI(GUI, speedDigit1, speedDigit2);
                    }
                }
            }

            nextCheck = Game.GameTime + 20;
        }
Ejemplo n.º 11
0
        public void SetPhotoMode()
        {
            if (WormholeActive && !TimeCircuits.GetHandler <SparksHandler>().IsWormholePlaying)
            {
                TimeCircuits.GetHandler <SparksHandler>().StartWormhole();
            }

            if (!WormholeActive && TimeCircuits.GetHandler <SparksHandler>().IsWormholePlaying)
            {
                TimeCircuits.GetHandler <SparksHandler>().StopWormhole();
            }

            if (GlowingCoilsActive && !_coilsProp.IsSpawned)
            {
                if (Main.CurrentTime.Hour >= 20 || (Main.CurrentTime.Hour >= 0 && Main.CurrentTime.Hour <= 5))
                {
                    _coilsProp.Model = ModelHandler.CoilsGlowingNight;
                }
                else
                {
                    _coilsProp.Model = ModelHandler.CoilsGlowing;
                }

                Mods.OffCoils = ModState.Off;
                _coilsProp.SpawnProp(false);
            }

            if (!GlowingCoilsActive && _coilsProp.IsSpawned)
            {
                Mods.OffCoils = ModState.On;
                _coilsProp.DeleteProp();
            }

            if (FluxCapacitorActive && !TimeCircuits.GetHandler <FluxCapacitorHandler>().TimeTravelEffect)
            {
                TimeCircuits.GetHandler <FluxCapacitorHandler>().StartTimeTravelEffect();
            }

            if (!FluxCapacitorActive && TimeCircuits.GetHandler <FluxCapacitorHandler>().TimeTravelEffect)
            {
                TimeCircuits.GetHandler <FluxCapacitorHandler>().StartNormalFluxing();
            }

            if (IceActive && !IsFreezing)
            {
                TimeCircuits.GetHandler <FreezeHandler>().StartFreezeHandling(false);
            }

            if (!IceActive && IsFreezing)
            {
                TimeCircuits.GetHandler <FreezeHandler>().Stop();
            }

            IsPhotoModeOn = WormholeActive | GlowingCoilsActive | FluxCapacitorActive | IceActive;
        }
Ejemplo n.º 12
0
        private void HandleCoilFlicker()
        {
            if (numOfProps == 11 | Game.GameTime < _nextFlicker)
            {
                return;
            }

            //// Choose how many coil props can spawn at one time
            float by = (TimeCircuits.Delorean.MPHSpeed - 65f) / (88f - 65f);

            if (TimeCircuits.IsPhotoModeOn)
            {
                by = (70 - 65f) / (88f - 65f);
            }

            numOfProps = Utils.Lerp(1, 11, by);

            // Delete all other props
            _separatedCoils?.ForEach(x => { x.Prop.IsVisible = false; });

            if (numOfProps >= 11)
            {
                numOfProps = 11;

                TimeCircuits.Delorean.Mods.OffCoils = ModState.Off;

                _coilsProp.SpawnProp(false);
            }
            else
            {
                List <int> propsToBeSpawned = Enumerable.Range(0, 11).OrderBy(x => Utils.Random.Next()).Take(numOfProps).ToList();

                foreach (var propindex in propsToBeSpawned)
                {
                    _separatedCoils[propindex].Prop.IsVisible = true;
                }

                // Set next flicker
                _nextFlicker = Game.GameTime + Utils.Random.Next(30, 60);
            }
        }
Ejemplo n.º 13
0
        public override void Process()
        {
            if(rotate)
            {
                currentTfcRotation = Utils.Lerp(currentTfcRotation, rotateTfcTo, Game.LastFrameTime * 8f);
                tfcHandle.SpawnProp(Vector3.Zero, new Vector3(0, currentTfcRotation, 0), false);

                var diff = Math.Abs(currentTfcRotation - rotateTfcTo);
                if (diff <= 0.001)
                    rotate = false;
            }
        }
Ejemplo n.º 14
0
        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;
            }
        }
Ejemplo n.º 15
0
        public GMCVanHandler(Vehicle vehicle)
        {
            Vehicle = vehicle;

            Open = false;

            finalRamp    = new AnimateProp(vehicle, ModelHandler.GMCVanRamps, "ramps_bone");
            rampSupports = new AnimateProp(vehicle, ModelHandler.GMCVanSupports, "supports_bone");

            finalRamp.SpawnProp(Vector3.Zero, finalRampRot);
            rampSupports.SpawnProp(Vector3.Zero, rampSupportsRot);

            //rampOpeningSound = new AudioPlayer($"VanOpening.wav", false);
        }
Ejemplo n.º 16
0
        public void Boost()
        {
            // Set the vent boost effect visible
            ventGlowing.SpawnProp();

            // Play boost sound
            if (!_hasPlayedBoostSound)
            {
                _boostSound.Play();
                _hasPlayedBoostSound = true;
            }

            // Apply force
            _forceToBeApplied += Vehicle.ForwardVector * 12f * Game.LastFrameTime;
        }
        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 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;
        }
Ejemplo n.º 19
0
        private void OnTimeCircuitsToggle()
        {
            if (!TimeCircuits.Delorean.IsGivenScaleformPriority)
            {
                return;
            }

            if (IsOn)
            {
                if (ModSettings.PlayFluxCapacitorSound)
                {
                    fluxCapacitor.Play();
                }

                destinationSlot.SetDate(DestinationTime);
                destinationSlot.SetVisible(false);
                destinationSlot.SetVisibleAt(true, 500, 600);

                previousSlot.SetDate(PreviousTime);
                previousSlot.SetVisible(false);
                previousSlot.SetVisibleAt(true, 500, 600);

                presentSlot.SetDate(Utils.GetWorldTime());
                presentSlot.SetVisible(false);
                presentSlot.SetVisibleAt(true, 500, 600);
            }
            else
            {
                if (fluxCapacitor.IsAnyInstancePlaying)
                {
                    fluxCapacitor?.Stop();
                }

                destinationSlot.SetVisibleAt(false, 750, 750);
                previousSlot.SetVisibleAt(false, 750, 750);
                presentSlot.SetVisibleAt(false, 750, 750);

                currentState = false;
                beep?.Stop();
                GUI.CallFunction("SET_DIODE_STATE", false);
                tickingDiodes?.DeleteProp();
                tickingDiodesOff?.SpawnProp();
            }
        }
Ejemplo n.º 20
0
        private void OnTimeCircuitsToggle()
        {
            if(IsOn)
            {
                tfcOn.SpawnProp(false);
                tfcOff.DeleteProp();

                rotate = true;
                rotateTfcTo = -45f;
            }
            else
            {
                tfcOff.SpawnProp(false);
                tfcOn.DeleteProp();

                rotate = true;
                rotateTfcTo = 0;
            }
        }
Ejemplo n.º 21
0
        private void SetEmpty(bool isOn)
        {
            if (Main.PlayerVehicle == Vehicle)
            {
                GUI.CallFunction("SET_EMPTY_STATE", !isOn);
            }

            if (Vehicle.IsVisible == false)
            {
                return;
            }

            if (isOn)
            {
                _emptyOff?.DeleteProp();
                _emptyGlowing.SpawnProp();
            }
            else
            {
                _emptyOff.SpawnProp();
                _emptyGlowing?.DeleteProp();
            }
        }
Ejemplo n.º 22
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 WheelAnimationPlayer(TimeCircuits circuits)
        {
            vehicle      = circuits.Vehicle;
            TimeCircuits = circuits;

            _roadWheel = TimeCircuits.Delorean.IsStockWheel ? WheelType.Stock : WheelType.Red;

            Model modelWheel     = _roadWheel == WheelType.Stock ? ModelHandler.WheelProp : ModelHandler.RedWheelProp;
            Model modelWheelRear = _roadWheel == WheelType.Stock ? ModelHandler.RearWheelProp : ModelHandler.RedWheelProp;

            foreach (var wheel in Utils.GetWheelPositions(vehicle))
            {
                string  wheelName  = wheel.Key;
                Vector3 offset     = wheel.Value;
                bool    leftWheel  = (wheelName.Contains("lf") || wheelName.Contains("lr"));
                bool    frontWheel = (wheelName.Contains("lf") || wheelName.Contains("rf"));

                Model   wheelModel     = !frontWheel ? modelWheelRear : modelWheel;
                Model   wheelGlowModel = !frontWheel ? ModelHandler.RearWheelGlowing : ModelHandler.WheelGlowing;
                Vector3 strutOffset    = Vector3.Zero;

                ModelHandler.RequestModel(wheelModel);
                ModelHandler.RequestModel(wheelGlowModel);

                if (leftWheel && frontWheel)
                {
                    strutOffset = strutFrontOffset;
                }
                else if (leftWheel && !frontWheel)
                {
                    strutOffset = strutRearOffset;
                }
                else if (!leftWheel && frontWheel)
                {
                    strutOffset = new Vector3(-strutFrontOffset.X, strutFrontOffset.Y, strutFrontOffset.Z);
                }
                else if (!leftWheel && !frontWheel)
                {
                    strutOffset = new Vector3(-strutRearOffset.X, strutRearOffset.Y, strutRearOffset.Z);
                }

                AnimateProp wheelAnimateProp = new AnimateProp(vehicle, wheelModel, offset, Vector3.Zero);

                AnimateProp wheelGlowAnimateProp = new AnimateProp(null, wheelGlowModel, Vector3.Zero, Vector3.Zero);

                AnimateProp strut = new AnimateProp(vehicle, ModelHandler.RequestModel(ModelHandler.Strut), strutOffset, leftWheel ? Vector3.Zero : new Vector3(0, 0, 180));
                strut.SpawnProp();

                AnimateProp disk = new AnimateProp(strut.Prop, ModelHandler.RequestModel(ModelHandler.Disk), frontWheel ? diskOffsetFromStrut : diskOffsetFromRearStrut, new Vector3(0, leftWheel ? 90 : -90, 0));
                disk.SpawnProp();

                AnimateProp piston = new AnimateProp(disk.Prop, ModelHandler.RequestModel(ModelHandler.Piston), frontWheel ? pistonOffsetFromDisk : pistonOffsetFromRearDisk, Vector3.Zero);
                piston.SpawnProp();

                if (leftWheel)
                {
                    leftStruts.Add(strut);
                    leftPistons.Add(piston);
                    leftDisks.Add(disk);

                    leftWheelProps.Add(wheelAnimateProp);
                    leftWheelGlowProps.Add(wheelGlowAnimateProp);
                }
                else
                {
                    rightStruts.Add(strut);
                    rightPistons.Add(piston);
                    rightDisks.Add(disk);

                    rightWheelProps.Add(wheelAnimateProp);
                    rightWheelGlowProps.Add(wheelGlowAnimateProp);
                }
            }

            currentPistonRotation = MAX_PISTON_ROTATION;

            ApplyAnimation(currentOffset, currentStrutOffset, currentRotation, currentPistonRotation);
        }
Ejemplo n.º 24
0
        public void Process()
        {
            if (!Vehicle.IsVisible)
            {
                speedNeedle.DeleteProp();
                rpmNeedle.DeleteProp();
                fuelNeedle.DeleteProp();
                tempNeedle.DeleteProp();
                oilNeedle.DeleteProp();
                voltNeedle.DeleteProp();
                doorIndicator.DeleteProp();
                leftFan.DeleteProp();
                rightFan.DeleteProp();

                suspensionLeftFront?.DeleteProp();
                suspensionLeftRear?.DeleteProp();
                suspensionRightFront?.DeleteProp();
                suspensionRightRear?.DeleteProp();

                return;
            }

            if (Game.Player.Character.Position.DistanceToSquared(Vehicle.Position) > 5f * 5f)
            {
                return;
            }

            spawnSuspension = !(DeloreanHandler.IsVehicleATimeMachine(Vehicle) && DeloreanHandler.GetTimeMachineFromVehicle(Vehicle).Mods.HoverUnderbody == ModState.On);

            if (Vehicle.IsEngineRunning)
            {
                // --- RPM --
                rpmRotation = Vehicle.CurrentRPM * 210;

                // --- Speed ---
                float speed = Vehicle.Speed / 0.27777f / 1.60934f;
                speedRotation = 270 * speed / 95;

                if (speedRotation > 270)
                {
                    speedRotation = 270;
                }

                fuelRotation = Utils.Lerp(fuelRotation, -31.5f, Game.LastFrameTime * 10f);
                tempRotation = Utils.Lerp(tempRotation, 4.5f, Game.LastFrameTime * 10f);
                oilRotation  = Utils.Lerp(oilRotation, -5f, Game.LastFrameTime * 10f);
                voltRotation = Utils.Lerp(voltRotation, 5.5f, Game.LastFrameTime * 10f);
            }
            else
            {
                fuelRotation = Utils.Lerp(fuelRotation, 0, Game.LastFrameTime * 15f);
                tempRotation = Utils.Lerp(tempRotation, 0, Game.LastFrameTime * 15f);
                oilRotation  = Utils.Lerp(oilRotation, 0, Game.LastFrameTime * 15f);
                voltRotation = Utils.Lerp(voltRotation, 0, Game.LastFrameTime * 15f);
            }

            if (Vehicle.EngineTemperature >= 50)
            {
                fanRotation += Game.LastFrameTime * 10.8f * (Vehicle.EngineTemperature - 50);

                leftFan.SpawnProp(Vector3.Zero, new Vector3(16f, fanRotation, 0), false);
                rightFan.SpawnProp(Vector3.Zero, new Vector3(16f, fanRotation, 0), false);

                if (fanRotation >= 360)
                {
                    fanRotation -= 360;
                }
            }

            speedNeedle.SpawnProp(Vector3.Zero, new Vector3(0, speedRotation, 0), false);
            rpmNeedle.SpawnProp(Vector3.Zero, new Vector3(0, rpmRotation, 0), false);
            fuelNeedle.SpawnProp(Vector3.Zero, new Vector3(0, fuelRotation, 0), false);
            tempNeedle.SpawnProp(Vector3.Zero, new Vector3(0, tempRotation, 0), false);
            oilNeedle.SpawnProp(Vector3.Zero, new Vector3(0, oilRotation, 0), false);
            voltNeedle.SpawnProp(Vector3.Zero, new Vector3(0, voltRotation, 0), false);

            if (spawnSuspension)
            {
                if (!suspensionLeftFront.IsSpawned)
                {
                    suspensionLeftFront.SpawnProp();
                    suspensionLeftRear.SpawnProp();
                    suspensionRightFront.SpawnProp();
                    suspensionRightRear.SpawnProp();
                }
            }
            else
            {
                suspensionLeftFront?.DeleteProp();
                suspensionLeftRear?.DeleteProp();
                suspensionRightFront?.DeleteProp();
                suspensionRightRear?.DeleteProp();
            }

            if (Utils.IsAnyOfFrontDoorsOpen(Vehicle))
            {
                doorIndicator.SpawnProp();
            }
            else
            {
                doorIndicator.DeleteProp();
            }
        }
Ejemplo n.º 25
0
        public override void Process()
        {
            _reentryTimer += Game.LastFrameTime;

            if (_reentryTimer > 2)
            {
                if (Vehicle.Driver == null)
                {
                    Vehicle.IsHandbrakeForcedOn = false;
                    Vehicle.SteeringAngle       = 0;
                }
            }

            if (!IsTimeTravelling)
            {
                return;
            }

            if (!Vehicle.IsVisible)
            {
                Vehicle.IsEngineRunning = false;
            }

            if (Vehicle == null)
            {
                return;
            }

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

            switch (_currentStep)
            {
            case 0:
                TimeCircuits.Delorean.LastVelocity = Vehicle.Velocity;

                TimeCircuits.WasOnTracks = TimeCircuits.IsOnTracks;

                if (IsOnTracks)
                {
                    TimeCircuits.GetHandler <RailroadHandler>().StopTrain();
                }

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

                // Invoke delegate
                TimeCircuits.OnTimeTravel?.Invoke();

                if (!IsRemoteControlled && Vehicle.GetPedOnSeat(VehicleSeat.Driver) == Main.PlayerPed && (!CutsceneMode || Utils.IsPlayerUseFirstPerson()))
                {
                    // Create a copy of the current status of the Delorean
                    TimeCircuits.Delorean.LastDisplacementCopy = TimeCircuits.Delorean.Copy;

                    timeTravelAudioInstant.Play();

                    if (Utils.IsPlayerUseFirstPerson())
                    {
                        _whiteSphere.SpawnProp();
                    }
                    else
                    {
                        ScreenFlash.FlashScreen(0.25f);
                    }

                    // Have to call SetupJump manually here.
                    TimeHandler.TimeTravelTo(TimeCircuits, DestinationTime);

                    Stop();

                    TimeCircuits.GetHandler <SparksHandler>().StartTimeTravelCooldown();

                    if (TimeCircuits.WasOnTracks)
                    {
                        TimeCircuits.GetHandler <RailroadHandler>().StartDriving(true);
                    }

                    if (!is99)
                    {
                        IsFueled = false;
                    }

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

                    if (Mods.Hoodbox == ModState.On && !TimeCircuits.IsWarmedUp)
                    {
                        TimeCircuits.GetHandler <HoodboxHandler>().SetInstant();
                    }

                    if (Mods.Hook == HookState.On)
                    {
                        Mods.Hook = HookState.Removed;
                    }

                    if (Mods.Plate == PlateType.Outatime)
                    {
                        Mods.Plate = PlateType.Empty;
                    }

                    // Invoke delegate
                    TimeCircuits.OnTimeTravelComplete?.Invoke();

                    // Stop handling
                    Stop();

                    //Add LastDisplacementCopy to remote Deloreans list
                    RemoteDeloreansHandler.AddDelorean(TimeCircuits.Delorean.LastDisplacementCopy);

                    return;
                }

                timeTravelAudioCutscene.Play();

                // Play the effects
                _timeTravelEffect.Play();

                // Play the light explosion
                _lightExplosion.Play();

                trails = FireTrailsHandler.SpawnForDelorean(
                    TimeCircuits,
                    is99,
                    (is99 || (Mods.HoverUnderbody == ModState.On && IsFlying)) ? 1f : 45,
                    is99 ? -1 : 15,
                    DeloreanType == DeloreanType.BTTF1, Mods.Wheel == WheelType.RailroadInvisible ? 75 : 50);

                // If the Vehicle is remote controlled or the player is not the one in the driver seat
                if (IsRemoteControlled || Vehicle.GetPedOnSeat(VehicleSeat.Driver) != Main.PlayerPed)
                {
                    MPHSpeed = 0;

                    // Stop remote controlling
                    TimeCircuits.GetHandler <RcHandler>()?.StopRC();

                    // Add to time travelled list
                    RemoteDeloreansHandler.AddDelorean(TimeCircuits.Delorean.Copy);

                    Utils.HideVehicle(Vehicle, true);

                    gameTimer = Game.GameTime + 300;

                    _currentStep++;
                    return;
                }

                // Create a copy of the current status of the Delorean
                TimeCircuits.Delorean.LastDisplacementCopy = TimeCircuits.Delorean.Copy;

                if (Mods.HoverUnderbody == ModState.On)
                {
                    CanConvert = false;
                }

                Game.Player.IgnoredByPolice = true;

                Main.HideGui = true;

                Main.DisablePlayerSwitching = true;

                Utils.HideVehicle(Vehicle, true);

                TimeCircuits.Delorean.IsInTime = true;

                gameTimer = Game.GameTime + 300;

                _currentStep++;
                break;

            case 1:
                _timeTravelEffect.Stop();

                if (Vehicle.GetPedOnSeat(VehicleSeat.Driver) != Main.PlayerPed)
                {
                    DeloreanHandler.RemoveDelorean(TimeCircuits.Delorean, true, true);
                    return;
                }

                gameTimer = Game.GameTime + 3700;
                _currentStep++;

                break;

            case 2:
                Screen.FadeOut(1000);
                gameTimer = Game.GameTime + 1500;

                _currentStep++;
                break;

            case 3:
                TimeHandler.TimeTravelTo(TimeCircuits, DestinationTime);
                FireTrailsHandler.RemoveTrail(trails);

                gameTimer = Game.GameTime + 1000;

                _currentStep++;
                break;

            case 4:
                TimeCircuits.OnTimeTravelComplete?.Invoke();

                gameTimer = Game.GameTime + 2000;
                Screen.FadeIn(1000);

                _currentStep++;
                break;

            case 5:
                //Add LastDisplacementCopy to remote Deloreans list
                RemoteDeloreansHandler.AddDelorean(TimeCircuits.Delorean.LastDisplacementCopy);

                Reenter();

                ResetFields();
                break;
            }
        }
        public override void Process()
        {
            if (!IsPlaying)
            {
                return;
            }

            switch (currentStep)
            {
            case 0:
                if (open)
                {
                    //float rotToAdd = (30f * Game.LastFrameTime) / 0.1f;
                    //_currentHandleRotation += rotToAdd;
                    _currentHandleRotation = Utils.Lerp(_currentHandleRotation, 30f, Game.LastFrameTime * 8f);

                    if (_currentHandleRotation >= 29f)
                    {
                        currentStep++;
                    }
                }
                else
                {
                    if (!_mrfusionClosed.IsAnyInstancePlaying)
                    {
                        _mrfusionClosed.Play();
                    }

                    //float rotationToSub = (70f * Game.LastFrameTime) / 0.35f;
                    //_currentRotation += rotationToSub;
                    _currentRotation = Utils.Lerp(_currentRotation, 0, Game.LastFrameTime * 8f);

                    if (_currentRotation >= -0.1)
                    {
                        currentStep++;
                    }
                }

                break;

            case 1:
                if (open)
                {
                    if (!_mrfusionOpen.IsAnyInstancePlaying)
                    {
                        _mrfusionOpen.Play();
                    }

                    //float rotationToAdd = (70f * Game.LastFrameTime) / 0.35f;
                    //_currentRotation -= rotationToAdd;
                    _currentRotation = Utils.Lerp(_currentRotation, -70f, Game.LastFrameTime * 8f);

                    if (_currentRotation <= -69)
                    {
                        Stop();
                    }
                }
                else
                {
                    //float rotToAdd = (30f * Game.LastFrameTime) / 0.1f;
                    //_currentHandleRotation -= rotToAdd;
                    _currentHandleRotation = Utils.Lerp(_currentHandleRotation, 0, Game.LastFrameTime * 8f);

                    if (_currentHandleRotation <= 0.1f)
                    {
                        Stop();
                    }
                }

                break;
            }

            _mrFusion.SpawnProp(new Vector3(0, 0, 0), new Vector3(_currentRotation, 0, 0), false);
            _mrFusionHandle.SpawnProp(new Vector3(0, 0, 0), new Vector3(_currentHandleRotation, 0, 0), false);
        }
Ejemplo n.º 27
0
 private void SpawnHoverGlow()
 {
     _hoverGlowing.SpawnProp();
     _upSound.Play();
     _startHoverGlowLater = false;
 }