예제 #1
0
 /// <summary>
 /// 创建最终药水对象
 /// </summary>
 /// <param name="factory">抽象工厂具体对象</param>
 public void MakeProduct(AbstractFactory factory)
 {
     _bottle = factory.CreateBottle();
     _cap    = factory.CreateCap();
     Console.WriteLine("准备英雄需要的瓶子和瓶盖。");
     _bottle.ShowInfo();
     _cap.ShowInfo();
     Console.WriteLine("开始往瓶子了灌入隐形药水,然后封上瓶盖。");
 }
예제 #2
0
        private ICap _cap;       // 瓶盖对象

        /// <summary>
        /// 创建最终药水对象
        /// </summary>
        /// <param name="bottleColor"></param>
        /// <param name="capShape"></param>
        public void MakeProduct(string bottleColor, string capShape)
        {
            _bottle = BottleFactory.CreateBottle(bottleColor);
            _cap    = CapFactory.CreateCap(capShape);
            Console.WriteLine("准备英雄需要的瓶子和瓶盖。");
            _bottle.ShowInfo();
            _cap.ShowInfo();
            Console.WriteLine("开始往瓶子了灌入隐形药水,然后封上瓶盖。");
        }
예제 #3
0
        public override IBottle GetBottle(TypeOfBottles type)
        {
            IBottle bottle = null;

            if (type == TypeOfBottles.LiteHealing)
            {
                bottle = new LiteHealingBottle();
            }
            else if (type == TypeOfBottles.RealHealing)
            {
                bottle = new RealHealingBottle();
            }
            else
            {
                bottle = new BerserkBottle();
            }

            return(bottle);
        }
예제 #4
0
 public Client(IFactory factory)
 {
     _water  = factory.CreateWater();
     _bottle = factory.CreateBottle();
 }
 public override void Add(IBottle duration)
 {
     bottleHolder.Push(duration);
 }
 public override void Add(IBottle duration)
 {
     bottleHolder.Push(duration);
 }
예제 #7
0
 abstract public void Add(IBottle duration);
예제 #8
0
 public void AddBottle(IBottle bottle)
 {
     bottles.Add(bottle);
 }
예제 #9
0
       public  void AddBottle(IBottle bottle)
        {
            bottles.Add(bottle);

        }
예제 #10
0
 abstract public void Add(IBottle duration);