Esempio n. 1
0
        // Constructor

        public Player()
        {
            name  = null;
            score = 0;

            gesturesNameList = new List <string> {
                "Rock", "Paper", "Scissors", "Lizard", "Spock"
            };

            Gesture rock     = new Rock();
            Gesture paper    = new Paper();
            Gesture scissors = new Scissors();
            Gesture lizard   = new Lizard();
            Gesture spock    = new Spock();

            gesturesList = new List <Gesture> {
                rock, paper, scissors, lizard, spock
            };

            AddToBeatsList(rock, scissors, lizard);
            AddToBeatsList(paper, rock, spock);
            AddToBeatsList(scissors, paper, lizard);
            AddToBeatsList(lizard, paper, spock);
            AddToBeatsList(spock, rock, scissors);
        }
Esempio n. 2
0
        public static Battle LoadObjects(bool multiPlayer, int rounds, List <string> names)
        {
            //Instantiate each gesture
            Gestures rock     = new Rock();
            Gestures paper    = new Paper();
            Gestures scissors = new Scissors();
            Gestures lizard   = new Lizard();
            Gestures spock    = new Spock();
            //store it into a list.
            List <Gestures> gestures = new List <Gestures> {
                rock, paper, scissors, lizard, spock
            };

            //Instantiate players
            Player player1 = new Human(gestures, names[0]);
            Player player2;

            if (multiPlayer == true)
            {
                player2 = new Human(gestures, names[1]);
            }
            else
            {
                player2 = new Computer(gestures);
            }
            List <Player> players = new List <Player> {
                player1, player2
            };

            Battle battle = new Battle(players, gestures, rounds, multiPlayer);

            return(battle);
        }
Esempio n. 3
0
        //Member Variables

        //Constructor
        public Person(string playerName)
        {
            this.playerName = playerName;

            Rock     rock     = new Rock();
            Paper    paper    = new Paper();
            Scissors scissors = new Scissors();
            Lizard   lizard   = new Lizard();
            Spock    spock    = new Spock();

            gestureChoices = new List <Gesture>()
            {
                rock, paper, scissors, lizard, spock
            };
        }
Esempio n. 4
0
        public Player()
        {
            Rock     rock     = new Rock();
            Paper    paper    = new Paper();
            Scissors scissors = new Scissors();
            Lizard   lizard   = new Lizard();
            Spock    spock    = new Spock();

            weaponry = new List <Gesture>();
            weaponry.Add(rock);
            weaponry.Add(paper);
            weaponry.Add(scissors);
            weaponry.Add(lizard);
            weaponry.Add(spock);
        }
Esempio n. 5
0
        //Constructor
        public Computer()
        {
            playerName = "Computer";
            rand       = new Random();

            Rock     rock     = new Rock();
            Paper    paper    = new Paper();
            Scissors scissors = new Scissors();
            Lizard   lizard   = new Lizard();
            Spock    spock    = new Spock();

            gestureChoices = new List <Gesture>()
            {
                rock, paper, scissors, lizard, spock
            };
        }
Esempio n. 6
0
 // Constructor
 public Game(string input)
 {
     rock      = new Rock();
     paper     = new Paper();
     scissors  = new Scissors();
     lizard    = new Lizard();
     spock     = new Spock();
     Gesture   = new Gesture();
     PlayerOne = new Player();
     Console.WriteLine("Player one enter your name: ");
     playerOneName = Console.ReadLine();
     if (input == "1")
     {
         PlayerTwo     = new Computer();
         playerTwoName = "Computer";
     }
     else if (input == "2")
     {
         Console.WriteLine("Player two enter your name: ");
         playerTwoName = Console.ReadLine();
         PlayerTwo     = new Player();
     }
 }