Пример #1
0
        public List <IBaseDuck> CreatList()
        {
            Random           rnd        = new Random();
            List <IBaseDuck> _baseDucks = new List <IBaseDuck>();

            for (int i = 0; i < 6; i++)
            {
                IBaseDuck duck = null;

                if (rnd.Next(0, 10) % 2 == 0)
                {
                    IFly         F = ReturnFly(rnd.Next(0, 2));
                    IQuick       Q = ReturnQuick(rnd.Next(0, 2));
                    IComposition C = ReturnComposition(rnd.Next(0, 3));

                    duck = new Duck(F, Q, C);
                }
                else
                {
                    Turkey turkey;

                    IKudah       K = ReturnKudah(rnd.Next(0, 10) % 2);
                    IFly2        F = ReturnFly2(rnd.Next(0, 10) % 2);
                    IComposition C = ReturnComposition(rnd.Next(0, 3));

                    turkey = new Turkey(F, K, C);

                    duck = new CreateDuck(turkey);
                }

                _baseDucks.Add(duck);
            }

            return(_baseDucks);
        }
Пример #2
0
        public IBaseDuck[] CreatArray()
        {
            Random rnd = new Random();

            IBaseDuck[] _baseDucks = new IBaseDuck[6];

            for (int i = 0; i < 6; i++)
            {
                IBaseDuck duck = null;

                if (rnd.Next(0, 10) % 2 == 0)
                {
                    IFly         F = ReturnFly(rnd.Next(0, 2));
                    IQuick       Q = ReturnQuick(rnd.Next(0, 2));
                    IComposition C = ReturnComposition(rnd.Next(0, 3));

                    duck = new Duck(F, Q, C);
                }
                else
                {
                    Turkey turkey;

                    IKudah       K = ReturnKudah(rnd.Next(0, 10) % 2);
                    IFly2        F = ReturnFly2(rnd.Next(0, 10) % 2);
                    IComposition C = ReturnComposition(rnd.Next(0, 3));

                    turkey = new Turkey(F, K, C);

                    duck = new CreateDuck(turkey);
                }

                _baseDucks[i] = duck;
            }

            return(_baseDucks);
        }
Пример #3
0
 protected BaseDuck(IFly _fly, IQuick _quick, IComposition _composition)
 {
     this._fly         = _fly;
     this._quick       = _quick;
     this._composition = _composition;
 }
Пример #4
0
 public Duck(IFly _fly, IQuick _quick, IComposition _composition) : base(_fly, _quick, _composition)
 {
 }