Ejemplo n.º 1
0
        public static void PlaneTakeoff(Ped pilot, Vehicle plane, RunwayID runwayID)
        {
            Runway     runway        = Runways[(int)runwayID];
            Vector3    start         = plane.Position;
            float      startDistance = start.DistanceTo2D(runway.End);
            PlaneSpeed planeSpeed;

            PlaneSpeeds.TryGetValue(plane.Model.Hash, out planeSpeed);
            float airSpeed     = planeSpeed.Air * 1;
            float groundSpeed  = planeSpeed.Ground;
            float initSpeed    = planeSpeed.Taxi;
            float initDistance = plane.Position.DistanceTo2D(runway.End);
            float distance     = plane.Position.DistanceTo2D(runway.End);

            while (distance > 10f)
            {
                float distanceTraveled = initDistance - distance;
                float speed            = distanceTraveled / initDistance * (groundSpeed - initSpeed) * 2 + initSpeed;
                speed = Math.Min(speed, groundSpeed);
                Vector3 end = runway.End;
                if (distance < 130f)
                {
                    end.Z = end.Z + 30;
                    speed = airSpeed;
                }
                DriveToCoord(pilot, plane, end, speed, DrivingStyle.Normal);
                distance = plane.Position.DistanceTo2D(runway.End);
                Yield();
            }
            plane.LandingGearState = VehicleLandingGearState.Retracting;
        }
Ejemplo n.º 2
0
        public static void PlaneLand(Ped pilot, Vehicle plane, RunwayID runwayId)
        {
            Runway  runway    = Runways[(int)runwayId];
            Vector3 touchdown = (runway.Start + runway.End) / 2;
            Vector3 start     = runway.Start;

            start.Z = start.Z + 30;

            KeyValuePair <Vector3, Vector3> approach = calculateApproach(runway.Start, runway.End);

            //GTA.UI.Screen.FadeOut(2000);
            //Wait(2000);
            plane.Position = approach.Key;
            plane.Speed    = 180;
            plane.Heading  = runway.Heading;
            PlaneFlySlow(pilot, plane, approach.Value, 20f);
            //GTA.UI.Screen.FadeIn(2000);
            plane.LandingGearState = VehicleLandingGearState.Deploying;
            pilot.Task.LandPlane(runway.Start, runway.End, plane);
            while (plane.WheelSpeed == 0)
            {
                Yield();
            }
            Normal(pilot, plane, runway.End, 30f);
        }
Ejemplo n.º 3
0
        void charter(RunwayID destination)
        {
            startCharter();

            // Taxi
            taxi1 = new Vector3(1591, 3190, 41);
            taxi2 = new Vector3(1586, 3210, 41f);
            taxi3 = new Vector3(1554, 3210, 41);
            Vector3    takeoff = new Vector3(1057.491f, 3074.598f, 70);
            Vector3    cruise  = new Vector3(-3621, 1973, 2250);
            PlaneSpeed charterSpeeds;

            Drive.PlaneSpeeds.TryGetValue(plane.Model.Hash, out charterSpeeds);
            Drive.Normal(pilot, plane, taxi1, charterSpeeds.Taxi);
            //Drive.Normal(pilot, plane, taxi2, charterSpeeds.Taxi);
            Drive.Normal(pilot, plane, taxi3, charterSpeeds.Taxi);
            Drive.PlaneTakeoff(pilot, plane, RunwayID.SSRA27);

            //Drive.PlaneFly(pilot, plane, cruise);
            //GTA.UI.Screen.ShowSubtitle("We have now reached our cruising altitude. Please enjoy your flight.");

            //Drive.PlaneFlyWarp(pilot, plane);

            Drive.PlaneLand(pilot, plane, destination);

            // Taxi
            pilot.Task.LeaveVehicle(plane, false);
            while (plane.Speed > 0)
            {
                Yield();
            }
            plane.IsTaxiLightOn   = false;
            plane.IsEngineRunning = false;
            plane.Doors[VehicleDoorIndex.FrontLeftDoor].Open();
            GTA.UI.Screen.ShowHelpTextThisFrame("done");
        }