示例#1
0
 public Hindernis(int x, int y, int width, int heigth, Snek s1, Snek s2)
 {
     xPos  = x;
     yPos  = y;
     w     = width;
     h     = heigth;
     snek1 = s1;
     snek2 = s2;
     Generate();
 }
示例#2
0
文件: Program.cs 项目: leshs/Snek
        //Ausgabe des Gewinners, wenn das Spiel zu Ende ist.
        public void GameOver(Snek player)
        {
            Console.Clear();
            Console.CursorLeft = 0;
            Console.CursorTop  = 15;


            ConsoleColor w        = ConsoleColor.White;
            ConsoleColor c1       = player1.GetColor();
            ConsoleColor c2       = player2.GetColor();
            int          gesamtP1 = player1.GetWinPoints() + player1.GetStrafPoints() + player1.GetFoodPoints();
            int          gesamtP2 = player2.GetWinPoints() + player2.GetStrafPoints() + player2.GetFoodPoints();

            Console.Write("\t\t\t\t");
            Console.ForegroundColor = c1;
            Console.Write("\t Spieler 1");
            Console.ForegroundColor = c2;
            Console.WriteLine("\t Spieler2");

            Console.ForegroundColor = w;
            Console.Write("\t\t\t Food-Punkte");
            Console.ForegroundColor = c1;
            Console.Write("\t    " + player1.GetFoodPoints());
            Console.ForegroundColor = c2;
            Console.WriteLine("\t\t    " + player2.GetFoodPoints());

            Console.ForegroundColor = w;
            Console.Write("\t\t\t Straf-Punkte");
            Console.ForegroundColor = c1;
            Console.Write("\t    " + player1.GetStrafPoints());
            Console.ForegroundColor = c2;
            Console.WriteLine("\t\t    " + player2.GetStrafPoints());

            Console.ForegroundColor = w;
            Console.Write("\t\t\t Bonus");
            Console.ForegroundColor = c1;
            Console.Write("\t\t    " + player1.GetWinPoints());
            Console.ForegroundColor = c2;
            Console.WriteLine("\t\t    " + player2.GetWinPoints());

            Console.ForegroundColor = w;
            Console.Write("\t\t\t Gesamt-Punkte");
            Console.ForegroundColor = c1;
            Console.Write("\t    " + gesamtP1);
            Console.ForegroundColor = c2;
            Console.WriteLine("\t\t    " + gesamtP2);

            Console.WriteLine();
            Console.ForegroundColor = player.GetColor();
            Console.WriteLine("\t\t\t\t " + player.GetName() + " hat gewonnen");
        }
示例#3
0
文件: Program.cs 项目: leshs/Snek
        //_____________________ Hier beginnen die "Check"-Methoden - sie überprüfen u.a. , ob die Schlange "bei einem Schritt auf etwas trifft" ____________________

        //Die Methode überprüft, ob ein Spieler verloren hat (Ob er in sich selbst, den anderen Spieler oder die Wand gefahren ist)
        public void CheckForLoose(Symbol symbolTemp, Snek snekTemp)
        {
            if (player1.CheckForSnek(symbolTemp) || player2.CheckForSnek(symbolTemp) || CheckForBorder(symbolTemp))
            {
                if (snekTemp == player1)
                {
                    player1Loose = true;
                }
                else
                {
                    player2Loose = true;
                }
            }
        }