Esempio n. 1
0
        static void Main(string[] args)
        {
            var shapeFactory = new ShapeFactory();
            var player1      = new ConsoleHumanPlayer()
            {
                Name = "Frank"
            };
            var player2 = new MachinePlayer()
            {
                Name = "PC"
            };

            Console.Write("Use decision machine? (Y): ");
            var userReponse = Console.ReadLine();

            var useDecisionMachine = userReponse.Equals("Y", StringComparison.InvariantCultureIgnoreCase);

            var game = new Game(player1, player2, useDecisionMachine);

            game.ShapePlayedEvent += Game_ShapePlayedEvent;

            do
            {
                Console.WriteLine($"Player 1 : {player1.Name}");
                Console.WriteLine($"Player 2 : {player2.Name}");

                var roundResult = game.PlayNewRound();

                Console.WriteLine($"Result: {(roundResult.IsDraw ? "Draw" : $"{roundResult.WinnerPlayer.Name} Wins!")}");

                Console.Write("Play again? (Y): ");
                userReponse = Console.ReadLine();
                Console.WriteLine("=====================================================");
            } while (userReponse.Equals("Y", StringComparison.InvariantCultureIgnoreCase));
Esempio n. 2
0
    void Awake()
    {
        machinePlayer  = GetComponent <MachinePlayer>();
        keyboardPlayer = GetComponent <KeyboardPlayer>();
        followPlayer   = GetComponent <FollowPlayer>();

        // color
        sprite = GetComponent <SpriteRenderer>();
        shadow = transform.GetChild(0).GetComponent <SpriteRenderer>();
    }