Ejemplo n.º 1
0
 public void ExistenceCheck(DateTime time)
 {
     if (DeloreanCopy.Circuits.DestinationTime > time)
     {
         if (DeloreanSpawned != null && DeloreanSpawned.Vehicle.Exists() && Main.PlayerVehicle != DeloreanSpawned.Vehicle)
         {
             DeloreanHandler.RemoveDelorean(DeloreanSpawned);
             DeloreanSpawned = null;
         }
     }
     else if (DeloreanCopy.Circuits.DestinationTime < time)
     {
         if (DeloreanSpawned == null || !DeloreanSpawned.Vehicle.Exists())
         {
             Spawn();
         }
     }
 }
Ejemplo n.º 2
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();
            }
        }