public override List <PlaneCoordinates> twoSizerPlane(int x, int y, Unit obj)
        {
            System.Diagnostics.Debug.WriteLine("PlaneCoordinatesInterpreter : creating TWO size coordinates");
            var coordinates = new List <PlaneCoordinates>();

            SizeBase sizeBase      = new SizeBase();
            var      sizeDecorator = new SizeDecorator(sizeBase, x);

            System.Diagnostics.Debug.WriteLine("{0} {1}", "PlaneFactory : Factory/Decorator. size added.", sizeDecorator.GetName());
            coordinates.Add(new PlaneCoordinates(sizeDecorator.GetResizer(), y, obj as Plane));
            System.Diagnostics.Debug.WriteLine("PlaneFactory : Factory. Two sizer Unit created.");

            return(coordinates);
        }
        /// <summary>
        /// Create Plane object
        /// </summary>
        /// <param name="ownerr"></param>
        /// <param name="battle"></param>
        /// <param name="x"></param>
        /// <param name="endx"></param>
        /// <param name="y"></param>
        /// <param name="endy"></param>
        /// <param name="isHorizontal"></param>
        /// <returns></returns>
        private Unit CreatePlane(User ownerr, Battle battle, int x, int endx, int y, int endy, bool isHorizontal, int type)
        {
            Unit obj = new Plane(ownerr, battle);

            /**decorator implementation**/
            obj.Coordinates.Add(new PlaneCoordinates(x, y, obj as Plane));
            SizeDecorator sizeDecorator;
            SizeBase      sizeBase = new SizeBase();

            Expression expr = new PlaneCoordinatesInterpreter();
            var        additionalCoordinates = expr.Interprete(type, x, y, obj);

            if (additionalCoordinates != null)
            {
                obj.Coordinates.AddRange(additionalCoordinates);
            }
            #region IŠKELTA Į INTERPRETATORIU

            /*switch (type)
             * {
             *  case 1: //one sizer Plane
             *      System.Diagnostics.Debug.WriteLine("PlaneFactory : Factory. One sizer Unit created.");
             *      break;
             *  case 2: //two sizer Plane
             *      sizeDecorator = new SizeDecorator(sizeBase, x);
             *      System.Diagnostics.Debug.WriteLine("{0} {1}", "PlaneFactory : Factory/Decorator. size added.", sizeDecorator.GetName());
             *      obj.Coordinates.Add(new PlaneCoordinates(sizeDecorator.GetResizer(), y, obj as Plane));
             *      System.Diagnostics.Debug.WriteLine("PlaneFactory : Factory. Two sizer Unit created.");
             *      break;
             *  case 3: //three sizer Plane
             *      sizeDecorator = new SizeDecorator(sizeBase, x);
             *      System.Diagnostics.Debug.WriteLine("{0} {1}", "PlaneFactory : Factory/Decorator. size added.", sizeDecorator.GetName());
             *      obj.Coordinates.Add(new PlaneCoordinates(sizeDecorator.GetResizer(), y, obj as Plane));
             *      sizeDecorator = new SizeDecorator(sizeBase, sizeDecorator.GetResizer());
             *      System.Diagnostics.Debug.WriteLine("{0} {1}", "PlaneFactory : Factory/Decorator. size added.", sizeDecorator.GetName());
             *      obj.Coordinates.Add(new PlaneCoordinates(sizeDecorator.GetResizer(), y, obj as Plane));
             *      System.Diagnostics.Debug.WriteLine("PlaneFactory : Factory. Three sizer Unit created.");
             *      break;
             * }*/
            #endregion
            obj.Size = obj.Coordinates.Count;
            System.Diagnostics.Debug.WriteLine(obj.ProductName);
            return(obj);
        }
Beispiel #3
0
 public FruitTea(BrandBase brand, SizeBase size) : base(brand, size)
 {
     Name = "Fruit Tea";
     Cost = 6.0;
 }
Beispiel #4
0
 public Coffee(BrandBase brand, SizeBase size) : base(brand, size)
 {
     Name = "Coffee";
     Cost = 5.0;
 }
Beispiel #5
0
 protected DrinkBase(BrandBase brand, SizeBase size)
 {
     _brand = brand;
     _size  = size;
 }