Example #1
0
 static void Main()
 {
     ConsoleProcesses.ConsoleSetter();
     foreach (var line in LineTypes.AllLines)
     {
         line.Draw();
     }
     int[] dotInfo = new int[2];
     ShotsLocation[] location = new ShotsLocation[3];
     for (int shots = 0; shots < 3; shots++)
     {
         ConsoleProcesses.PrintResult(shots, dotInfo);
         ConsoleProcesses.ColorSetter(ConsoleColor.DarkGreen);
         GameManager Engine = new GameManager();
         HorozontalMovement rulerLine = new HorozontalMovement(Engine.LinerX, LineTypes.AllLines[Engine.LinerX]);
         rulerLine.Draw();
         int ShootX ,ShootY = 0;
         int[] pointData = new int[2];
         ShootX = Engine.HorizontalAiming(rulerLine, shots);
         pointData = Engine.VerticalAiming(ShootX, dotInfo, shots);
         ShootY = pointData[1];
         location[shots].X = ShootX;
         location[shots].Y = ShootY;
         dotInfo[0] -= Engine.ResultChecking(shots, location, ShootX, ShootY, pointData);
         dotInfo[0] += pointData[0];
         GreatingsEventArgs greating = new GreatingsEventArgs();
         Engine.Subscribe(greating);
         greating.Message(dotInfo[0]);
         Thread.Sleep(500);
         new MoveThroughLine(ShootX, Dot.ContentToString(Strings.emptyString)).Draw();
     }
     ConsoleProcesses.PrintResult(3, dotInfo);
 }
Example #2
0
 public int ResultChecking(int shots,ShotsLocation[] location, int ShootX, int ShootY, int[] pointData)
 {
     int reduseScore = 0;
     try
     {
         for (int i = 0; i < shots; i++)
         {
             if (location[i].X == ShootX && location[i].Y == ShootY)
             {
                 throw new ArrowOverArrowException("You've hit the same location");
             }
         }
     }
     catch (ArrowOverArrowException aoae)
     {
         Console.SetCursorPosition(0, Console.WindowHeight - 1);
         Console.Write(aoae.Message);
         reduseScore = pointData[0];
         Thread.Sleep(1000);
     }
     return reduseScore;
 }