Beispiel #1
0
        public static IEnumerable <VehicleAction> Create(VehicleType type, FlightDirection direction, int siteNum)
        {
            switch (type)
            {
            case VehicleType.FollowMeVan:
                return(new FollowMeActionsSequenceFactory(direction, siteNum).CreateTyped());

            case VehicleType.Stairs:
                return(new StairsActionsSequenceFactory(direction, siteNum).CreateTyped());;

            case VehicleType.Bus:
                return(new BusActionsSequenceFactory(direction, siteNum).CreateTyped());

            case VehicleType.BaggageLoader:
                return(new BaggageLoaderActionsSequenceFactory(direction, siteNum).CreateTyped());

            case VehicleType.BaggageVan:
                return(new BaggageVanActionsSequenceFactory(direction, siteNum).CreateTyped());

            case VehicleType.VipShuttle:
                return(new VipActionsSequenceFactory(direction, siteNum).CreateTyped());

            case VehicleType.Refueler:
            case VehicleType.CateringTruck:
                return(new GenericActionsSequenceFactory(type, direction, siteNum).CreateTyped());

            default:
                return(Enumerable.Empty <VehicleAction>());
            }
        }
Beispiel #2
0
        public FlightFids ConvertFromFlightShedule(NVAOMAFLIGHTSCHEDULE from, FlightDirection direction = FlightDirection.Arrival)
        {
            var ret = new FlightFids();

            this.FillFromFlightShedule(from, ret, direction);
            return(ret);
        }
Beispiel #3
0
        /// <summary>
        /// Pick and create a random target.
        /// </summary>
        /// <param name="direction">The direction of the flight.</param>
        /// <returns>To and From with airport names.</returns>
        private (string from, string to) PickRandomTarget(FlightDirection direction)
        {
            string randomTarget = randomDataService.RandomFlightTarget();

            if (direction == FlightDirection.Landing)
            {
                return(randomTarget, Constants.CONTROL_TOWER_NAME);
            }
            return(Constants.CONTROL_TOWER_NAME, randomTarget);
        }
Beispiel #4
0
 public void FillFromFlightShedule(NVAOMAFLIGHTSCHEDULE from, FlightFids to, FlightDirection direction = FlightDirection.Arrival)
 {
     to.Direction = direction;
     to.ID        = direction == FlightDirection.Arrival ? from.RECID : (-from.RECID);
     to.TransDate = from.TRANSDATE;
     to.Company   = from.CUSTACCOUNT;
     to.Flight    = (direction == FlightDirection.Arrival) ? from.FLIGHTCODEARRIVAL : from.FLIGHTCODEDEPARTURE;
     to.Dest      = (direction == FlightDirection.Arrival) ? from.STARTPORT : from.ENDPORTDEP;
     to.Trans     = (direction == FlightDirection.Arrival) ? (from.STOPOVER1 + " " + from.STOPOVER2) : (from.STOPOVER1DEP + " " + from.STOPOVER2DEP);
     //....
 }
        /// <summary>
        /// Bewirkt das Bewegen des Projektils in Richtung "FlightDirection" in Abhängigkeit von "VelocityMultiplier".
        /// </summary>
        /// <remarks>"VelocityMultiplier" ist eine Modifikation für "FlightDirection", welche auf "Position" addiert wird, um die Bewegung zu simulieren.</remarks>
        public override void Update(GameTime gameTime)
        {
            // Normalisieren der Flugrichtung
            FlightDirection.Normalize();

            // Bewegt das Projektil mit seiner Geschwindigkeit in die gewünschte Richtung. TimeFactor bewirkt Zeitlupeneffekt
            Position += FlightDirection * Velocity * (float)gameTime.ElapsedGameTime.TotalSeconds * GameItem.TimeFactor;

            // Wenn das Projektil das Spielfeld verlässt (mit Puffer, damit es besser aussieht), dann wird es zerstört.
            if ((Position.X < 2.0f * CoordinateConstants.LeftBorder) || (Position.X > 2.0f * CoordinateConstants.RightBorder) ||
                (Position.Y < 2.0f * CoordinateConstants.BottomBorder) || (Position.Y > 2.0f * CoordinateConstants.TopBorder))
            {
                // Das Destroyed-Event soll dabei nicht ausgelöst werden. Deshalb wird IsAlive direkt auf false gesetzt.
                IsAlive = false;
            }
        }
Beispiel #6
0
        /// <summary>
        /// Build a random flight.
        /// </summary>
        /// <returns>Newly generated random flight.</returns>
        private Flight CreateFlight()
        {
            FlightDirection direction = randomDataService.RandomFlightDirection();

            (string from, string to) = PickRandomTarget(direction);
            Airplane airplane    = airplaneSelectorService.GetAirplane();
            int      rndDelay    = randomDataService.RandomNumber(Constants.MINIMAL_FLIGHT_DELAY, Constants.MAXIMAL_FLIGHT_DELAY);
            DateTime plannedTime = DateTime.Now.AddSeconds(rndDelay);

            if (airplane is null)
            {
                return(null);
            }
            return(new Flight {
                Direction = direction, AirplaneId = airplane.Id, From = from, To = to, PlannedTime = plannedTime
            });
        }
Beispiel #7
0
        public override CanonicalFlight Translate(AirlineCompanySAS sasObject)
        {
            FlightDirection direction = FlightDirection.Unknown;

            if (sasObject.ArivalDeparture == "A")
            {
                direction = FlightDirection.Arrival;
            }
            else if (sasObject.ArivalDeparture == "D")
            {
                direction = FlightDirection.Departure;
            }

            return(new CanonicalFlight()
            {
                Airline = "Scandinavian Airlines",
                Destination = sasObject.Destination,
                Direction = direction,
                EventDateTime = DateTime.Parse(sasObject.dato + " " + sasObject.tidspunkt),
                FlightNo = "SAS" + sasObject.FlightNo.Substring(4),
                Origin = sasObject.Origin,
            });
        }
Beispiel #8
0
        public void Fly(FlightDirection direction, int distance = 20)
        {
            Utils.AssertValue(distance, 20, 500, "distance parameter can range from value 20 to 500 !");
            AssertConnected();
            string flightCommand;

            switch (direction)
            {
            case FlightDirection.Up:
                flightCommand = "up";
                break;

            case FlightDirection.Down:
                flightCommand = "down";
                break;

            case FlightDirection.Left:
                flightCommand = "left";
                break;

            case FlightDirection.Right:
                flightCommand = "right";
                break;

            case FlightDirection.Forward:
                flightCommand = "forward";
                break;

            case FlightDirection.Backward:
                flightCommand = "back";
                break;

            default:
                throw new NotImplementedException("Make sure all the enum's possibilities are checked.");
            }
            _communicationManager.SendCommand(flightCommand + " " + distance);
        }
Beispiel #9
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Get Direction Vector
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    protected Vector3 GetDirectionPathPoint(FlightDirection eDirection)
    {
        switch (eDirection)
        {
        case FlightDirection.UP:                                        { return(GetUpVector()); }

        case FlightDirection.UP_LEFT:                           { return(GetUpVector() + GetLeftVector()); }

        case FlightDirection.UP_RIGHT:                          { return(GetUpVector() + GetRightVector()); }

        case FlightDirection.FORWARD:                           { return(GetForwardVector()); }

        case FlightDirection.FORWARD_UP:                        { return(GetForwardVector() + GetUpVector()); }

        case FlightDirection.FORWARD_UP_LEFT:           { return(GetForwardVector() + GetUpVector() + GetLeftVector()); }

        case FlightDirection.FORWARD_UP_RIGHT:          { return(GetForwardVector() + GetUpVector() + GetRightVector()); }

        case FlightDirection.FORWARD_DOWN:                      { return(GetForwardVector() + GetDownVector()); }

        case FlightDirection.FORWARD_DOWN_LEFT:         { return(GetForwardVector() + GetDownVector() + GetLeftVector()); }

        case FlightDirection.FORWARD_DOWN_RIGHT:        { return(GetForwardVector() + GetDownVector() + GetRightVector()); }

        case FlightDirection.DOWN:                                      { return(GetDownVector()); }

        case FlightDirection.DOWN_LEFT:                         { return(GetDownVector() + GetLeftVector()); }

        case FlightDirection.DOWN_RIGHT:                        { return(GetDownVector() + GetRightVector()); }

        case FlightDirection.LEFT:                                      { return(GetLeftVector()); }

        case FlightDirection.RIGHT:                                     { return(GetRightVector()); }

        default:                                                                        { return(Vector3.zero); }
        }
    }
 public RandomDataServiceMock(FlightDirection direction = FlightDirection.Landing, int presetRandomResult = 0)
 {
     this.direction          = direction;
     this.presetRandomResult = presetRandomResult;
 }
Beispiel #11
0
 /// <summary>
 /// Get the relevant Flight handlers.
 /// </summary>
 /// <param name="direction">The direction to get the flight handlers for.</param>
 /// <returns>A <see cref="IEnumerable{IStationFlightHandler}"/> of the next stations.</returns>
 private IEnumerable <IStationFlightHandler> GetNextStationListByDirection(FlightDirection direction) =>
 direction == FlightDirection.Landing ? LandingStations : TakeoffStations;
Beispiel #12
0
 public VipActionsSequenceFactory(FlightDirection direction, int siteNum) :
     base(VehicleType.VipShuttle, direction, siteNum)
 {
 }
 public FollowMeActionsSequenceFactory(FlightDirection direction, int siteNum) :
     base(VehicleType.FollowMeVan, direction, siteNum)
 {
 }
Beispiel #14
0
 protected ActionsSequenceFactory(VehicleType type, FlightDirection direction, int siteNum)
 {
     this.type      = type;
     this.direction = direction;
     this.siteNum   = siteNum;
 }
 public BaggageVanActionsSequenceFactory(FlightDirection direction, int siteNum) :
     base(VehicleType.BaggageVan, direction, siteNum)
 {
 }
Beispiel #16
0
 public StairsActionsSequenceFactory(FlightDirection direction, int siteNum) :
     base(VehicleType.Stairs, direction, siteNum)
 {
 }
Beispiel #17
0
 public GenericActionsSequenceFactory(VehicleType type, FlightDirection direction, int siteNum) :
     base(type, direction, siteNum)
 {
 }