示例#1
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);
        }
示例#2
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;
        }