예제 #1
0
        /// <summary>
        /// Activate the Play of the game, switches players after every turn, verifies if their is a tie.
        /// </summary>
        /// <returns>Winner</returns>
        public Player Play()
        {
            int counter = 1;

            while (!CheckForWinner(Board))
            {
                Board.DisplayBoard();

                if (PlayerOne.IsTurn)
                {
                    PlayerOne.TakeTurn(Board);
                    counter++;
                    SwitchPlayer();
                }
                else
                {
                    PlayerTwo.TakeTurn(Board);
                    counter++;
                    SwitchPlayer();
                }

                CheckForWinner(Board);

                if (counter >= 9)
                {
                    return(Winner);
                }

                Console.Clear();
            }

            Board.DisplayBoard();

            return(Winner);
        }
예제 #2
0
        private void GenGame()
        {
            GameField = new TicTacToeField[3, 3];

            for (int x = 0; x <= 2; x++)
            {
                for (int y = 0; y <= 2; y++)
                {
                    GameField[x, y] = new TicTacToeField();
                }
            }

            if (PlayerOne == null)
            {
                PlayerOne = new TikTakToe.TicTacToePlayer(this, "Player 1 - x", "x");
            }

            if (PlayerTwo == null)
            {
                PlayerTwo = new TikTakToe.TicTacToePlayer(this, "Player 2 - o", "o");
            }

            PlayerOne.NewTry();
            PlayerTwo.NewTry();
            AllPlayers.Clear();
            AllPlayers.Add(PlayerOne);
            AllPlayers.Add(PlayerTwo);
        }
예제 #3
0
        public void IsItWin(string[,] gameBg, PlayerOne playerOne, PlayerTwo playerTwo)
        {
            playerOne.PlayerCheckerCount = 0;
            playerTwo.PlayerCheckerCount = 0;

            //checks the array for playerOne checkers
            foreach (var checker in gameBg)
            {
                if (checker == "X " || checker == "kX")
                {
                    //adds one everytime it finds a checker
                    playerOne.PlayerCheckerCount++;
                }
                //checks the array for playerTwo checkers
                else if (checker == "O " || checker == "kO")
                {
                    //adds one everytime it finds a checker
                    playerTwo.PlayerCheckerCount++;
                }
            }
            //if no playerOne checkers found
            if (playerOne.PlayerCheckerCount == 0)
            {
                //set win to true
                win = true;
            }
            //if no playerTwo checkers found
            else if (playerTwo.PlayerCheckerCount == 0)
            {
                //set win to true
                win = true;
            }
        }
예제 #4
0
        /// <summary>
        /// Create a new empty game instance.
        /// </summary>
        public GameInstance()
        {
            // create players
            players = new List <Player>();
            players.Add(new Player(this));
            players.Add(new Player(this));
            PlayerList = new ReadOnlyCollection <Player>(players);

            // assign opponents
            PlayerOne.SetOpponent(PlayerTwo);
            PlayerTwo.SetOpponent(PlayerOne);

            // prepare saving original decklists
            decklists = new Dictionary <Player, List <SimpleCard> >();

            // prepare mulligan phase
            mulligans        = new Dictionary <Player, Dictionary <Card, bool> >();
            mulliganComplete = new Dictionary <Player, bool>();

            // finalize preparations
            foreach (Player player in players)
            {
                decklists.Add(player, new List <SimpleCard>());
                mulligans.Add(player, new Dictionary <Card, bool>());
                mulliganComplete.Add(player, false);
            }

            // update game state
            state = GameState.Loading;
        }
예제 #5
0
        private async Task PlayCurrentRound()
        {
            if (_cancellationToken.IsCancellationRequested)
            {
                return;
            }
            if (PlayerOne.PlayerType != RockPaperScissors.Common.Enums.PlayerType.HumanPlayer)
            {
                _nextPlayerOneMove = PlayerOne.GetNextMove(Game.Rules);
            }
            MoveModel move = Game.Rules.MoveList.FirstOrDefault(i => i.RuleValue == _nextPlayerOneMove);
            string    nextPlayerOneMoveDescription = move.Description;


            if (PlayerTwo.PlayerType != RockPaperScissors.Common.Enums.PlayerType.HumanPlayer)
            {
                _nextPlayerTwoMove = PlayerTwo.GetNextMove(Game.Rules);
            }
            move = Game.Rules.MoveList.FirstOrDefault(i => i.RuleValue == _nextPlayerTwoMove);
            string nextPlayerTwoMoveDescription = move.Description;

            await TurnCountDown();

            if (_cancellationToken.IsCancellationRequested)
            {
                return;
            }
            PlayerOneChoice = nextPlayerOneMoveDescription;
            PlayerTwoChoice = nextPlayerTwoMoveDescription;
            DisplayWinningMove(_nextPlayerOneMove.Value, _nextPlayerTwoMove.Value);

            await DecideNextAction();
        }
예제 #6
0
 private void Awake()
 {
     body   = GetComponent <Rigidbody2D>();
     anim   = GetComponent <Animator>();
     player = GameObject.Find("Player").GetComponent <PlayerTwo>();
     main   = GameObject.Find("Main Camera").GetComponent <MainCameraTwo>();
 }
예제 #7
0
 public void Draw(string[,] gameBg, PlayerOne playerOne, PlayerTwo playerTwo)
 {
     Console.Clear();
     //sets window size
     Console.SetWindowSize(200, 45);
     Console.WriteLine("        1    2    3    4    5    6    7    8          ");
     Console.WriteLine("           _____     _____     _____     _____");
     Console.WriteLine("     |:::::     :::::     :::::     :::::     |       ");
     Console.WriteLine("    H|:::::  {0} :::::  {1} :::::  {2} :::::  {3} |H         {4}'s STATS", gameBg[2, 3], gameBg[2, 5], gameBg[2, 7], gameBg[2, 9], playerOne.PlayerName);
     Console.WriteLine("     |:::::_____:::::_____:::::_____:::::_____|          Move Count:{0}", playerOne.PlayerTurnCount);
     Console.WriteLine("     |     :::::     :::::     :::::     :::::|          Score:{0}", playerOne.PlayerScore);
     Console.WriteLine("    G|  {0} :::::  {1} :::::  {2} :::::  {3} :::::|G  ", gameBg[3, 2], gameBg[3, 4], gameBg[3, 6], gameBg[3, 8]);
     Console.WriteLine("     |_____:::::_____:::::_____:::::____ :::::|");
     Console.WriteLine("     |:::::     :::::     :::::     :::::     |          {0}'s STATS", playerTwo.PlayerName);
     Console.WriteLine("    F|:::::  {0} :::::  {1} :::::  {2} :::::  {3} |F         Move Count:{4}", gameBg[4, 3], gameBg[4, 5], gameBg[4, 7], gameBg[4, 9], playerTwo.PlayerTurnCount);
     Console.WriteLine("     |:::::_____:::::_____:::::_____:::::_____|          Score:{0}", playerTwo.PlayerScore);
     Console.WriteLine("     |     :::::     :::::     :::::     :::::|       ");
     Console.WriteLine("    E|  {0} :::::  {1} :::::  {2} :::::  {3} :::::|E  ", gameBg[5, 2], gameBg[5, 4], gameBg[5, 6], gameBg[5, 8]);
     Console.WriteLine("     |_____:::::_____:::::_____:::::____ :::::|");
     Console.WriteLine("     |:::::     :::::     :::::     :::::     |       ");
     Console.WriteLine("    D|:::::  {0} :::::  {1} :::::  {2} :::::  {3} |D", gameBg[6, 3], gameBg[6, 5], gameBg[6, 7], gameBg[6, 9]);
     Console.WriteLine("     |:::::_____:::::_____:::::_____:::::_____|       ");
     Console.WriteLine("     |     :::::     :::::     :::::     :::::|       ");
     Console.WriteLine("    C|  {0} :::::  {1} :::::  {2} :::::  {3} :::::|C  ", gameBg[7, 2], gameBg[7, 4], gameBg[7, 6], gameBg[7, 8]);
     Console.WriteLine("     |_____:::::_____:::::_____:::::____ :::::|");
     Console.WriteLine("     |:::::     :::::     :::::     :::::     |       ");
     Console.WriteLine("    B|:::::  {0} :::::  {1} :::::  {2} :::::  {3} |B", gameBg[8, 3], gameBg[8, 5], gameBg[8, 7], gameBg[8, 9]);
     Console.WriteLine("     |:::::_____:::::_____:::::_____:::::_____|       ");
     Console.WriteLine("     |     :::::     :::::     :::::     :::::|       ");
     Console.WriteLine("    A|  {0} :::::  {1} :::::  {2} :::::  {3} :::::|A  ", gameBg[9, 2], gameBg[9, 4], gameBg[9, 6], gameBg[9, 8]);
     Console.WriteLine("     |_____:::::_____:::::_____:::::____ :::::|");
     Console.WriteLine("        1    2    3    4    5    6    7    8");
 }
예제 #8
0
    // Use this for initialization
    void Start()
    {
        rb = GetComponent <Rigidbody> ();
        if (rb != null)
        {
            rb.velocity = new Vector3(-1, 0) * iSpeed;
            curSpeed    = iSpeed;
        }
        GameObject p1Score = GameObject.Find("P1Score");

        p1Text    = p1Score.GetComponent <Text> ();
        playerOne = GameObject.Find("Player").GetComponent <PlayerOne>();
        GameObject p2Score = GameObject.Find("P2Score");

        p2Text    = p2Score.GetComponent <Text> ();
        playerTwo = GameObject.Find("PlayerTwo").GetComponent <PlayerTwo>();
        if (playerTwo == null)
        {
            playerComp = GameObject.Find("PlayerTwo").GetComponent <PlayerComp> ();
            playerTwo  = new PlayerTwo();
        }
        else
        {
            playerComp = new PlayerComp();
        }
        clearScore();
    }
예제 #9
0
        /// <summary>
        /// Create new players and launch the Fighting method
        /// </summary>
        /// <returns>Returns True if the player wants to continue playing</returns>
        public static bool CreatePlayers()
        {
            Console.WriteLine(" Enter the first Character/Player Name ");
            string nameOne = Console.ReadLine();

            Console.WriteLine(" Enter the first player Damage per attack points from 1 - 10 ");
            string damagePlayerOne = Console.ReadLine();
            int    damageIntOne    = int.Parse(damagePlayerOne);

            // Making a new instance of Player one
            PlayerOne playerOne = new PlayerOne(nameOne, damageIntOne);

            Console.WriteLine(" Enter the second Character/Player Name ");
            string nameTwo = Console.ReadLine();

            // Making a new instance of Player two
            PlayerTwo playerTwo = new PlayerTwo(nameTwo);

            StartFighting(playerOne, playerTwo);

            // After the round is finished this will execute to ask the user to play again
            Console.WriteLine(" Do you want to start a new fight? Type 'Y' for Yes or 'N' for No");
            string keepFighting     = Console.ReadLine();
            char   keepFightingChar = char.Parse(keepFighting);

            bool fightOn;

            fightOn = char.ToUpper(keepFightingChar) == 'Y';

            return(fightOn);
        }
예제 #10
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log(gameObject.name);
        PlayerOne playerOne = collision.GetComponent <PlayerOne>();
        PlayerTwo playerTwo = collision.GetComponent <PlayerTwo>();

        if (gameObject.CompareTag("BlueWaterfall"))
        {
            Debug.Log(collision.gameObject.name + " : " + gameObject.name + " : ");
            if (collision.gameObject.CompareTag("player 1"))
            {
                playerOne.color = "blue";
                collision.gameObject.GetComponent <Animator>().Play("Base Layer.PlayerTwoLeft");
            }
            if (collision.gameObject.CompareTag("player 2"))
            {
                playerTwo.color = "blue";
                collision.gameObject.GetComponent <Animator>().Play("Base Layer.Player2ColorChange");
            }
        }
        else
        {
            if (collision.gameObject.CompareTag("player 1"))
            {
                playerOne.color = "pink";
                collision.gameObject.GetComponent <Animator>().Play("Base Layer.PlayerOneLeft");
            }
            if (collision.gameObject.CompareTag("player 2"))
            {
                playerTwo.color = "pink";
                collision.gameObject.GetComponent <Animator>().Play("Base Layer.SoftBoiPink");
            }
        }
    }
예제 #11
0
 private void Awake()
 {
     //reference components
     body   = GetComponent <Rigidbody2D>();
     anim   = GetComponent <Animator>();
     player = GameObject.Find("Player").GetComponent <PlayerTwo>();
 }
예제 #12
0
    private void BonusLifeGainCheck()
    {
        Player p1 = PlayerOne.GetComponent <Player>();

        if (p1.GetScore() > scoreNeededForExtraLife_p1)
        {
            scoreNeededForExtraLife_p1 += scoreNeededIncrease;
            if (p1.GetCurrentLives() < 6)
            {
                p1.GainLife();
            }
        }

        if (PlayerTwo.activeSelf)
        {
            Player p2 = PlayerTwo.GetComponent <Player>();
            if (p2.GetScore() > scoreNeededForExtraLife_p2)
            {
                scoreNeededForExtraLife_p2 += scoreNeededIncrease;
                if (p2.GetCurrentLives() < 6)
                {
                    p2.GainLife();
                }
            }
        }
    }
예제 #13
0
        /// <summary>
        /// An attempt to jump start the game when no player can act and the game is not yet over.
        /// Plays one card each from their closed stacks on hand to respective open stack.
        /// </summary>
        public void Draw()
        {
            // Stale mate, players pick up the respective stack. Two cards are needed to do a draw.
            if ((PlayerOne.Hand.Cards.Count + PlayerTwo.Hand.Cards.Count) < 2)
            {
                while (LeftStack.Cards.Count > 0)
                {
                    PlayerOne.PickUpCard(LeftStack.DrawCard());
                }
                while (RightStack.Cards.Count > 0)
                {
                    PlayerTwo.PickUpCard(RightStack.DrawCard());
                }
            }

            // If one player has an empty hand, and the other player has more than one card on hand
            // the player without a card will draw one from the other players hand.
            if (PlayerOne.Hand.Cards.Count == 0 && PlayerTwo.Hand.Cards.Count > 1)
            {
                PlayerOne.Hand.Cards.Push(PlayerTwo.Hand.DrawCard());
            }

            else if (PlayerTwo.Hand.Cards.Count == 0 && PlayerOne.Hand.Cards.Count > 1)
            {
                PlayerTwo.Hand.Cards.Push(PlayerOne.Hand.DrawCard());
            }

            LeftStack.AddCard(PlayerOne.Hand.DrawCard(), true);
            RightStack.AddCard(PlayerTwo.Hand.DrawCard(), true);
        }
예제 #14
0
 private void Awake()
 {
     _player       = GameObject.Find("Player").GetComponent <PlayerTwo>();
     _uiManagerTwo = GameObject.Find("Canvas").GetComponent <UIManagerTwo>();
     _mainTwo      = GameObject.Find("Main Camera").GetComponent <MainCameraTwo>();
     levelLoader   = GameObject.Find("Levels GameObject").GetComponent <LevelLoader>();
 }
예제 #15
0
        /// <summary>
        /// Activate the Play of the game
        /// </summary>
        /// <returns>Winner</returns>
        public Player Play()
        {
            Player Draw = new Player();

            Draw.Name = "Its a draw!";
            int turnCount = -1;

            PlayerOne.Marker = "X";
            PlayerTwo.Marker = "O";


            while (CheckForWinner(Board) == false)
            {
                turnCount++;
                if (PlayerOne.IsTurn == true)
                {
                    PlayerOne.TakeTurn(Board);
                }
                if (PlayerTwo.IsTurn == true)
                {
                    PlayerTwo.TakeTurn(Board);
                }
                Board.DisplayBoard();
                if (turnCount == 9 && CheckForWinner(Board) == false)
                {
                    Winner = Draw;
                    return(Winner);
                }
                SwitchPlayer();
                NextPlayer();
            }
            return(Winner);
        }
예제 #16
0
 /// <summary>
 /// Başlangıç kartlarını çeker
 /// </summary>
 public void DrawFirstCards()
 {
     for (var i = 0; i < StartingCardCount; i++)
     {
         PlayerOne.DrawCard();
         PlayerTwo.DrawCard();
     }
 }
예제 #17
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        PlayerTwo controller = other.GetComponent <PlayerTwo>();

        UiRecord.instance.SetValue(controller.timer);
        Debug.Log(controller.timer);
        SceneManager.LoadScene("MainScene");
    }
예제 #18
0
        /// <summary>
        /// Activate the Play of the game
        /// </summary>
        /// <returns>Winner</returns>
        public Player Play()
        {
            //TODO: Complete this method and utilize the rest of the class structure to play the game.

            /*
             * Complete this method by constructing the logic for the actual playing of Tic Tac Toe.
             *
             * A few things to get you started:
             * 1. A turn consists of a player picking a position on the board with their designated marker.
             * 2. Display the board after every turn to show the most up to date state of the game
             * 3. Once a Winner is determined, display the board one final time and return a winner
             *
             * Few additional hints:
             *  Be sure to keep track of the number of turns that have been taken to determine if a draw is required
             *  and make sure that the game continues while there are unmarked spots on the board.
             *
             * Use any and all pre-existing methods in this program to help construct the method logic.
             */

            Board.DisplayBoard();
            int counter = 0;

            do
            {
                //Console.WriteLine("# of turns: " + counter);
                if (PlayerOne.IsTurn == true)
                {
                    PlayerOne.TakeTurn(Board);
                    Board.DisplayBoard();
                    SwitchPlayer();
                    counter++;
                }
                else
                {
                    PlayerTwo.TakeTurn(Board);
                    Board.DisplayBoard();
                    SwitchPlayer();
                    counter++;
                }
            } while (counter < 9 && CheckForWinner(Board) == false);
            if (CheckForWinner(Board) == true && PlayerOne.IsTurn == false)
            {
                Console.WriteLine("Player one wins");
                Board.DisplayBoard();
                return(PlayerOne);
            }
            else if (CheckForWinner(Board) == true && PlayerTwo.IsTurn == false)
            {
                Console.WriteLine("Player two wins");
                Board.DisplayBoard();
                return(PlayerTwo);
            }
            else
            {
                Console.WriteLine("cats game");
            }
            return(null);
        }
예제 #19
0
        public void RunGameLoop()
        {
            while (true)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo keyInfo = Console.ReadKey();
                    if (keyInfo.Key == ConsoleKey.Y)
                    {
                        PlayerOne.MoveUp();
                    }

                    if (keyInfo.Key == ConsoleKey.S)
                    {
                        PlayerOne.MoveDown(Console.WindowHeight);
                    }

                    if (keyInfo.Key == ConsoleKey.UpArrow)
                    {
                        PlayerTwo.MoveUp();
                    }

                    if (keyInfo.Key == ConsoleKey.DownArrow)
                    {
                        PlayerTwo.MoveDown(Console.WindowHeight);
                    }
                }

                Physics.MoveBall(Console.WindowWidth, Console.WindowHeight);

                if (HasPlayerOneScored())
                {
                    ResetBallPosition(Console.WindowWidth, Console.WindowHeight);
                    Ball.RightDirection = false;
                    Ball.UpDirection    = true;
                    PlayerOne.Score++;
                    ConsoleBoard.PrintPlayerScoredMessage(PlayerOne);
                    Console.ReadKey();
                }

                if (HasPlayerTwoScored())
                {
                    ResetBallPosition(Console.WindowWidth, Console.WindowHeight);
                    Ball.RightDirection = true;
                    Ball.UpDirection    = true;
                    PlayerTwo.Score++;
                    ConsoleBoard.PrintPlayerScoredMessage(PlayerTwo);
                    Console.ReadKey();
                }
                Console.Clear();
                ConsoleBoard.DrawPlayerOne(PlayerOne);
                ConsoleBoard.DrawPlayerTwo(PlayerTwo, Console.WindowWidth);
                ConsoleBoard.DrawBall(Ball);
                ConsoleBoard.PrintScore(PlayerOne, PlayerTwo);
                Thread.Sleep(60);
            }
        }
예제 #20
0
 private void Awake()
 {
     body      = GetComponent <Rigidbody2D>();
     anim      = GetComponent <Animator>();
     player    = GameObject.Find("Player").GetComponent <PlayerTwo>();
     render    = GetComponent <SpriteRenderer>();
     main      = GameObject.Find("Main Camera").GetComponent <MainCameraTwo>();
     uiManager = GameObject.Find("Canvas").GetComponent <UIManagerTwo>();
 }
예제 #21
0
        /// <summary>
        /// Activate the Play of the game
        /// Chris morto helped alot with this method - i was super close !
        /// </summary>
        /// <returns>Winner</returns>
        public Player Play()
        {
            int    turns  = 0;
            Player player = null;

            Board.DisplayBoard();

            while (Winner == null && turns < 9)
            {
                if (PlayerOne.IsTurn)
                {
                    player = PlayerOne;
                    PlayerOne.TakeTurn(Board);
                }
                if (PlayerTwo.IsTurn)
                {
                    player = PlayerTwo;
                    PlayerTwo.TakeTurn(Board);
                }
                //reshow board with changes
                Console.Clear();
                Board.DisplayBoard();
                //check for winner
                bool win = CheckForWinner(Board);
                //comes back true or false
                if (win)
                {
                    Winner = player;
                    turns++;
                }
                if (win == false)
                {
                    turns++;
                    SwitchPlayer();
                }
                Console.WriteLine($"Turns : {turns}");
            }
            return(Winner);


            //TODO: Complete this method and utilize the rest of the class structure to play the game.

            /*
             * Complete this method by constructing the logic for the actual playing of Tic Tac Toe.
             *
             * A few things to get you started:
             * 1. A turn consists of a player picking a position on the board with their designated marker.
             * 2. Display the board after every turn to show the most up to date state of the game
             * 3. Once a Winner is determined, display the board one final time and return a winner
             *
             * Few additional hints:
             *  Be sure to keep track of the number of turns that have been taken to determine if a draw is required
             *  and make sure that the game continues while there are unmarked spots on the board.
             *
             * Use any and all pre-existing methods in this program to help construct the method logic.
             */
        }
예제 #22
0
        public void Tick(EnterNumberViewModel turn)
        {
            PlayerOne.Guess = turn.Number;
            PlayerOne.Supposition.Add(PlayerOne.Guess);

            PlayerTwo.Guess = PlayerTwo.GuessNumberV2();
            PlayerTwo.Supposition.Add(PlayerTwo.Guess);
            //PlayerTwo.AddGenNumberToList();
            //WhoWon();
        }
예제 #23
0
        public void WritePiecesInRow(int row)
        {
            var piecesOfPlayersInARow = PlayerOne.GetPiecesOfRow(row);

            piecesOfPlayersInARow.AddRange(PlayerTwo.GetPiecesOfRow(row));
            foreach (var piece in piecesOfPlayersInARow)
            {
                Table[piece.Position.Item1, piece.Position.Item2] = piece;
            }
        }
예제 #24
0
    public void OnCollisionEnter2D(Collision2D other)
    {
        PlayerTwo player = other.gameObject.GetComponent <PlayerTwo>();

        if (player != null)
        {
            player.changeHealth(-1);
            player.PlaySound(collectedClip);
        }
    }
        public void KeysArentAcceptedWhenLocked()
        {
            INonNpc npc = new PlayerTwo();
            for (int i = 1; i < 172; i++)
            {
                var key = (Key)i;

                Assert.AreEqual(false, npc.KeyStroke(key));
            }
        }
예제 #26
0
        public PlayerInformation GetUnitInformationForPlayers(List <string> comparisonInfo)
        {
            try
            {
                List <UnitWithStat> PlayerOne;
                List <UnitWithStat> PlayerTwo;

                Player PlayerOneHelp;
                Player PlayerTwoHelp;

                var helper = Authenticate();

                string unitDefId = comparisonInfo[2];
                //var helper = Authenticate();
                var codesToRequest = new List <string>()
                {
                    comparisonInfo[0], comparisonInfo[1]
                };
                var codesToRequest2 = new List <string>()
                {
                    comparisonInfo[0], comparisonInfo[1]
                };
                List <List <UnitWithStat> > playerOneandTwo = GetPlayerOneAndTwo(codesToRequest);
                List <Player> playerOneandTwoHelp           = GetPlayerOneAndTwoFromHelp(codesToRequest2);

                PlayerOne = playerOneandTwo[0];
                PlayerTwo = playerOneandTwo[1];

                PlayerOneHelp = playerOneandTwoHelp[0];
                PlayerTwoHelp = playerOneandTwoHelp[1];

                List <UnitWithStat> unitDataToReturn = new List <UnitWithStat>();
                List <Roster>       rosterToReturn   = new List <Roster>();

                unitDataToReturn.Add(PlayerOne.Where(x => x.DefId == unitDefId).First());
                unitDataToReturn.Add(PlayerTwo.Where(x => x.DefId == unitDefId).First());

                rosterToReturn.Add(PlayerOneHelp.Roster.Where(x => x.DefId == unitDefId).First());
                rosterToReturn.Add(PlayerTwoHelp.Roster.Where(x => x.DefId == unitDefId).First());

                PlayerInformation pinfo = new PlayerInformation()
                {
                    PlayerNames = new List <string>()
                    {
                        PlayerOneHelp.Name, PlayerTwoHelp.Name
                    }, UnitStatList = unitDataToReturn, RosterList = rosterToReturn, UnitInfo = helper.FetchGearTiersForUnits(unitDefId)[0].unitTierList
                };
                return(pinfo);
            }
            catch (Exception ex)
            {
                _logger.LogCritical(LoggingEvents.GetUnitInformationForPlayers, ex, "GetUnitInformationForPlayers Exception");
                return(new PlayerInformation());
            }
        }
예제 #27
0
    void Start()
    {
        // get rigid body component
        bulletMove = GetComponent <Rigidbody2D>();

        // get script for player one health
        playerTwo       = GameObject.Find("Player 2");
        P2ControlScript = playerTwo.GetComponent <PlayerTwo>();

        // get script for player two health
        playerOne      = GameObject.Find("Player 1");
        P1HealthScript = playerOne.GetComponent <PlayerOneHealth>();

        // move bullet to the left
        if (P2ControlScript.bulletLeft)
        {
            // bullet moving left
            bulletMove.velocity = new Vector3(-bulletSpeed, 0, 0);
        }

        // move bullet ot the right
        else if (P2ControlScript.bulletRight)
        {
            // bullet moving right
            bulletMove.velocity = new Vector3(bulletSpeed, 0, 0);
        }

        // move bullet diagonally right and up
        else if (P2ControlScript.bulletTopRight)
        {
            // bullet moving right
            bulletMove.velocity = new Vector3(bulletSpeed, bulletSpeed, 0);
        }

        // move bullet diagonally left and up
        else if (P2ControlScript.bulletTopLeft)
        {
            // bullet moving right
            bulletMove.velocity = new Vector3(-bulletSpeed, bulletSpeed, 0);
        }

        // move bullet diagonally right and down
        else if (P2ControlScript.bulletBottomRight)
        {
            // bullet moving right
            bulletMove.velocity = new Vector3(bulletSpeed, -bulletSpeed, 0);
        }

        // move bullet diagonally left and down
        else if (P2ControlScript.bulletBottomLeft)
        {
            // bullet moving right
            bulletMove.velocity = new Vector3(-bulletSpeed, -bulletSpeed, 0);
        }
    }
 public void KeysArentAccepted()
 {
     INonNpc npc = new PlayerTwo();
     for (int i = 1; i < 172; i++)
     {
         var key = (Key)i;
         npc.OpenControls();
         if (key != Key.Left && key != Key.Down && key != Key.Right)
             Assert.AreEqual(false, npc.KeyStroke(key));
     }
 }
예제 #29
0
        public void Throw()
        {
            if (!CanThrow)
            {
                throw new InvalidOperationException();
            }

            var currentRound = new Round(PlayerOne.MakeAMove(), PlayerTwo.MakeAMove());

            UpdateScore(currentRound.FinishRound());
        }
예제 #30
0
 private void addWarBounty(List <Card> playerOnePlayedCards, List <Card> playerTwoPlayedCards)
 {
     //Each player puts down three cards
     for (int i = 0; i < 3; i++)
     {
         playerOnePlayedCards.Add(PlayerOne.PlayCard());
         playerTwoPlayedCards.Add(PlayerTwo.PlayCard());
         outputText += string.Format("{0} of {1}&nbsp;&nbsp;-&nbsp;&nbsp;{2} of {3}<br />",
                                     playerOnePlayedCards.Last().Name, playerOnePlayedCards.Last().Suite,
                                     playerTwoPlayedCards.Last().Name, playerTwoPlayedCards.Last().Suite);
     }
 }
예제 #31
0
 public void Replay(GameBoard game, PlayerOne playerOne, PlayerTwo playerTwo)
 {
     // if the queue has elements
     while (replayQueue.Count > 0)
     {
         //redraw gameboard using queue until empty
         game.Draw(replayQueue.Dequeue(), playerOne, playerTwo);
         //adds 2 sec delay
         int milliseconds = 2000;
         Thread.Sleep(milliseconds);
     }
 }
예제 #32
0
        public void StartGame()
        {
            PriorityCounter = 0;
            PhaseCounter    = 0;

            PlayerOne.DrawCards(7);
            PlayerTwo.DrawCards(7);

            AddStateAction(new PhaseAction(PhaseSequence[PhaseCounter]));
            PhaseChange?.Invoke(CurrentPhase);
            ContinueGame();
        }
        public void KeysAreBound()
        {
            INonNpc npc = new PlayerTwo();

            npc.OpenControls();
            Assert.AreEqual(true, npc.KeyStroke(Key.Left));
            Assert.AreEqual(Pick.Rock,npc.Pick);

            npc.OpenControls();
            Assert.AreEqual(true, npc.KeyStroke(Key.Down));
            Assert.AreEqual(Pick.Paper, npc.Pick);

            npc.OpenControls();
            Assert.AreEqual(true, npc.KeyStroke(Key.Right));
            Assert.AreEqual(Pick.Scissors, npc.Pick);
        }
 public void PlayerSlot()
 {
     INonNpc npc = new PlayerTwo();
     Assert.AreEqual(2, npc.Slot);
 }