Beispiel #1
0
    public static string Describe(TravelMethod travelMethod)
    {
        if (travelMethod == TravelMethod.Walking)
        {
            return("You're traveling to your destination by walking.");
        }

        return("You're traveling to your destination on horseback.");
    }
        public IVehicle CreateVehicle(TravelMethod howToTravel)
        {
            switch (howToTravel)
            {
            case TravelMethod.Drive:
                return(new Car());

            case TravelMethod.Fly:
                return(new Plane());

            default:
                throw new NotSupportedException("Factory cannot create vehicle to travel by method: " + howToTravel);
            }
        }
Beispiel #3
0
 public static string Describe(Character character, Destination destination, TravelMethod travelMethod)
 {
     throw new NotImplementedException("Please implement the (static) GameMaster.Describe(Character, Destination, TravelMethod) method");
 }
Beispiel #4
0
 public static string Describe(TravelMethod travelMethod)
 {
     throw new NotImplementedException("Please implement the (static) GameMaster.Describe(TravelMethod) method");
 }
 public static string Describe(TravelMethod travelMethod) =>
 travelMethod switch
 {
Beispiel #6
0
 public static string Describe(Character character, Destination destination, TravelMethod travelMethod = TravelMethod.Walking)
 {
     return($"{Describe(character)} {Describe(travelMethod)} {Describe(destination)}");
 }