Пример #1
0
 public override void Draw(int ticks)
 {
     this.X++;
     if (this.X > 20)
     {
         this.X = 10;
     }
     if (ticks % 2 == 0)
     {
         for (int i = 1; i <= 5; i++)
         {
             for (int j = 1; j <= 5; j++)
             {
                 if (i >= j && i >= 6 - j)
                 {
                     SingletonEngine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.Yellow);
                 }
             }
         }
     }
     else
     {
         for (int i = 1; i <= 5; i++)
         {
             for (int j = 1; j <= 5; j++)
             {
                 if (i <= j && i <= 6 - j)
                 {
                     SingletonEngine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.Blue);
                 }
             }
         }
     }
 }
Пример #2
0
 public override void Draw(int ticks)
 {
     this.X++;
     if (this.X > 30)
     {
         this.X = 20;
     }
     if (ticks % 2 == 1)
     {
         for (int i = 0; i < 5; i++)
         {
             for (int j = 0; j < 5; j++)
             {
                 SingletonEngine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.White);
             }
         }
     }
     else
     {
         for (int i = 1; i <= 5; i++)
         {
             for (int j = 1; j <= 5; j++)
             {
                 if ((j >= i && j >= 6 - i) || (j <= i && j <= 6 - i))
                 {
                     SingletonEngine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.Red);
                 }
             }
         }
     }
 }
Пример #3
0
        public static SingletonEngine2D Instance()
        {
            if (instance == null)
            {
                instance = new SingletonEngine2D();
            }

            return(instance);
        }
Пример #4
0
 public override void Draw(int ticks)
 {
     for (int i = 0; i < 5; i++)
     {
         for (int j = 0; j < 5; j++)
         {
             SingletonEngine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.White);
         }
     }
 }
Пример #5
0
        static void Main(string[] args)
        {
            ShapeFabricFabric s1 = new StaticShapeFabric();
            ShapeFabricFabric s2 = new MoveableShapeFabric();

            SingletonEngine2D.Draw(new Shape[]
            {
                s1.CreatorRectangle(5, 5),
                s1.CreatorTriangle(10, 10),
                s2.CreatorRectangle(15, 15),
                s2.CreatorTriangle(20, 20)
            });
        }
Пример #6
0
 public override void Draw(int ticks)
 {
     d.Message();
     for (int i = 1; i <= 5; i++)
     {
         for (int j = 1; j <= 5; j++)
         {
             if (i >= j && i >= 6 - j)
             {
                 SingletonEngine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.Yellow);
             }
         }
     }
 }