Example #1
0
        public static void DemoGame(Game game, Scoreboard scoreboard)
        {
            while (game.Winner == null)
            {
                scoreboard.Display();
                Console.WriteLine("\n\n");

                Round round = game.NextRound(new Deck(true, true));

                while (!round.IsOver)
                {
                    if (round.NextPlayer != null)
                    {
                        Console.Write(round.NextPlayer.Name + ", press any key to draw a card.");
                        Console.ReadKey();
                    }

                    if (round.NextMove() != null)
                    //if (round.NextMove(new Card(Rank.Joker,Suit.Clubs)) != null)
                    {
                        Console.CursorLeft = 0;
                        ConsoleHelper.ClearConsoleLine();
                        Console.WriteLine(round.CurrentMove.ToString());

                        System.Threading.Thread.Sleep(2);
                    }


                    if (round.IsOver)
                    {
                        string endOfRoundMessage = "\n";

                        if (round.WinningMove != null)
                        {
                            endOfRoundMessage += round.WinningMove.Player.Name + " wins with a " + round.WinningMove.Card.ToString();
                        }
                        else
                        {
                            endOfRoundMessage += "Nobody wins";
                        }

                        Console.WriteLine(endOfRoundMessage);
                        Console.Write("Press any key continue");
                        Console.ReadKey();
                    }
                }

                Console.Clear();
            }

            scoreboard.Display();
            Player winner = game.Winner;

            Console.WriteLine("\n\n" + winner.Name + " wins with a score of " + winner.Score);
            Console.WriteLine("Press any key to end the game");
            Console.ReadKey();
        }
Example #2
0
    private bool IsGameOver()
    {
        _io.WriteLine();
        if (_scoreboard.ScoresAreEqual)
        {
            _scoreboard.Display(Resource.Formats.EndOfSecondHalf);
            _clock.StartOvertime();
            return(false);
        }

        _scoreboard.Display(Resource.Formats.EndOfGame);
        return(true);
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        scoreboard.Display();
        scoreboard.Update();
        LabelsFollow();

        if (startGate.activeSelf)
        {
            if (CheckMarbleStop())
            {
                Button btn = startButton.GetComponent <Button>();
                btn.gameObject.SetActive(true);
                btn.onClick.AddListener(TaskOnClick);
            }
        }

        // Update audio volume for each marble based on its speed (caps out at 20)
        foreach (GameObject marble in marbles)
        {
            AudioSource audio       = marble.GetComponent <AudioSource>();
            Rigidbody   rb          = marble.GetComponent <Rigidbody>();
            float       velocityX   = Mathf.Abs(rb.velocity.x);
            float       velocityZ   = Mathf.Abs(rb.velocity.z);
            float       maxVelocity = Mathf.Max(velocityX, velocityZ);
            audio.volume = maxVelocity / 10;
        }
    }
Example #4
0
    private void DisplayScores(int user_score)
    {
        viewing_scores = true;

        final_score.gameObject.SetActive(false);
        space_to_restart.gameObject.SetActive(false);

        score_screen.Display(user_score);
    }
Example #5
0
        public static void DemoAutoCompleteRounds(Game game, Scoreboard scoreboard)
        {
            while (game.Winner == null)
            {
                Round round = game.NextRound(new Deck(true, true));

                while (!round.IsOver)
                {
                    round.NextMove();
                }

                scoreboard.Display();
                Console.WriteLine();

                foreach (Move move in round.Moves)
                {
                    Console.WriteLine(move.ToString());
                }

                string endOfRoundMessage = "\n";

                if (round.WinningMove != null)
                {
                    endOfRoundMessage += round.WinningMove.Player.Name + " wins with a " + round.WinningMove.Card.ToString();
                }
                else
                {
                    endOfRoundMessage += "Nobody wins";
                }

                Console.WriteLine(endOfRoundMessage);
                Console.Write("Press any key continue");
                Console.ReadKey();

                Console.Clear();
            }

            scoreboard.Display();
            Player winner = game.Winner;

            Console.WriteLine("\n\n" + winner.Name + " wins with a score of " + winner.Score);
            Console.WriteLine("Press any key to end the game");
            Console.ReadKey();
        }
Example #6
0
        public static void DemoAutoCompleteGame(Game game, Scoreboard scoreboard)
        {
            game.AuotComplete();

            scoreboard.Display();
            Player winner = game.Winner;

            Console.WriteLine("\n\n" + winner.Name + " wins with a score of " + winner.Score);
            Console.WriteLine("Press any key to end the game");
            Console.ReadKey();
        }