// Создать изменения для изменения очередности хода
        private IList <StateChange> CreateTurnChange(ChangeData data)
        {
            int seatIdx = (int)data["seatIdx"];
            var message = new PlayerTurn(session.Room.PlayerSeats[seatIdx]);

            return(new StateChange[] { CreateChange(message, data) });
        }
示例#2
0
        int EvaluateHeuristic(GameBoardState boardState, PlayerTurn maxTurn)
        {
            if (boardState.Winner != null)
            {
                return(boardState.Winner == maxTurn ? int.MaxValue : int.MinValue);
            }
            int score = 0;

            foreach (Point[] winningComb in WinningCombinations)
            {
                foreach (Point position in winningComb)
                {
                    PlayerTurn?piece = boardState.Board[position.Y, position.X];
                    if (piece == maxTurn)
                    {
                        score++;
                    }
                    else if (piece == GameLogicUtils.Next(maxTurn))
                    {
                        score--;
                    }
                }
            }
            return(score);
        }
 private void Start()
 {
     //at the start of the game, the various states will be:
     CurrentMacroPhase = MacroPhase.Preparation;
     CurrentTurnState  = TurnState.choosePlayer;
     CurrentPlayerTurn = PlayerTurn.Curve_Turn;
 }
示例#4
0
    //public bool moreDialogue = true;
    //Image playerNav;

    void Awake()
    {
        NPCEntity   = gameObject.GetComponent <NPCEntity>();
        playerStats = GameObject.Find("PlayerController").GetComponent <PlayerStats>();
        playerTurn  = GameObject.Find("PlayerNav").GetComponent <PlayerTurn>();
        //playerNav = GameObject.Find("PlayerNav").GetComponent<Image>();
    }
示例#5
0
        private static void GameLoop()
        {
            while (true)
            {
                try
                {
                    GameBoard.PrintBoard();

                    PlayerTurn turn = ProcessPlayerTurn();

                    GameBoard.WritePlayerTutnInBoard(Player, turn);

                    var checkWin = GameBoard.CheckWin();
                    if (checkWin)
                    {
                        ClearScreen();
                        GameBoard.PrintBoard();
                        System.Console.WriteLine($"{Player.Name} win!");
                        break;
                    }
                    //draw
                    Player.ChangePlayerTurn();
                }
                catch (Exception e)
                {
                    System.Console.WriteLine(e.Message);
                }

                ClearScreen();
            }
        }
示例#6
0
 public Turn(PlayerTurn pt, Vector2 loc)
     : base(loc)
 {
     turn = pt;
     hand = new Hand(pt);
     deck = new Deck(pt);
 }
 private void Awake()
 {
     PlayerStats = GameObject.Find("PlayerController").GetComponent <PlayerStats>();
     NPCEntity   = GameObject.Find("NPC").GetComponent <NPCEntity>();
     button      = gameObject.GetComponent <Button>();
     playerTurn  = GameObject.Find("PlayerNav").GetComponent <PlayerTurn>();
 }
示例#8
0
        private double Maximizer(GridModel grid, int depth, double alpha, double beta)
        {
            double bestScore = alpha;

            foreach (var direction in Vector.Directions)
            {
                var newGrid = new GridModel(grid);
                int deltaScore;
                if (PlayerTurn.Move(newGrid, direction, out deltaScore))
                {
                    if (depth == 0)
                    {
                        // leaf node, static evaluation
                        return(StaticEvaluation(newGrid));
                    }
                    else
                    {
                        alpha = Math.Max(alpha, AlphaBetaSearch(newGrid, depth - 1, false, alpha, beta));
                    }

                    if (alpha > beta) // pruning
                    {
                        return(beta);
                    }
                }
            }
            return(alpha);
        }
    public void NextLevel()
    {
        PlayerTurn.Clear();
        SoundManager.instance.StopBGM();
        SoundManager.instance.PlaySFX(3);
        loadingScreen.SetActive(true);
        if (SceneManager.GetActiveScene().buildIndex == 9)
        {
            PlayerPrefs.SetInt("runCutscene", 1);
            SceneManager.LoadScene("Cutscenes");
        }
        else if (SceneManager.GetActiveScene().buildIndex == 14)
        {
            PlayerPrefs.SetInt("runCutscene", 3);
            SceneManager.LoadScene("Cutscenes");
        }
        else if (SceneManager.GetActiveScene().buildIndex == 19)
        {
            PlayerPrefs.SetInt("runCutscene", 5);
            SceneManager.LoadScene("Cutscenes");
        }
        else
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
        }

        if (PlayerPrefs.HasKey("tutorialRan"))
        {
            PlayerPrefs.DeleteKey("tutorialRan");
        }
    }
        public static PlayerTurn Next(this PlayerTurn e)
        {
            switch (e)
            {
            case PlayerTurn.CivilSociety:
                return(PlayerTurn.Leader);

            case PlayerTurn.Leader:
                return(PlayerTurn.MilitaryConstruction);

            case PlayerTurn.MilitaryConstruction:
                return(PlayerTurn.MilitaryOrders);

            case PlayerTurn.MilitaryOrders:
                return(PlayerTurn.MilitaryActions);

            case PlayerTurn.MilitaryActions:
                return(PlayerTurn.Resting);

            case PlayerTurn.Resting:
                return(PlayerTurn.CivilSociety);

            default:
                return(PlayerTurn.Resting);
            }
        }
示例#11
0
 void Awake()
 {
     scriptHolder = GameObject.FindGameObjectWithTag("ScriptHolder");
     teamChecker  = scriptHolder.GetComponent <TeamChecker> ();
     playerTurn   = scriptHolder.GetComponent <PlayerTurn> ();
     soldierBonus = this.GetComponent <SoldierBonus> ();
 }
示例#12
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            PictureBox p = sender as PictureBox;

            if (p.Image != null)
            {
                return;
            }
            if (turn == PlayerTurn.none)
            {
                return;
            }

            if (turn == PlayerTurn.player1)
            {
                p.Image = player1.Image;
            }
            else
            {
                p.Image = player2.Image;
            }
            winner = GetWinner();
            if (winner == Winner.none)
            {
                turn = (PlayerTurn.player1 == turn) ? PlayerTurn.player2 : PlayerTurn.player1;
            }
            else
            {
                turn = PlayerTurn.none;
            }
            ShowTurn();
        }
示例#13
0
 /// <summary>
 /// http://stackoverflow.com/questions/22342854/what-is-the-optimal-algorithm-for-the-game-2048
 /// </summary>
 /// <param name="name"></param>
 /// <param name="description"></param>
 protected BaseBot(String name, String description, bool canLearn = false)
 {
     Name = name;
     Description = description;
     CanLearn = canLearn;
     PlayerTurn = new PlayerTurn();
 }
示例#14
0
    void Start()
    {
        //sharedController = this;

        print("Begin");
        gameMode       = GameMode.SelectTerritory;
        action         = Action.DefenseSetup;
        playerTurn     = PlayerTurn.Defense;
        selectedSpace  = null;
        playerTurnSign = GameObject.Find("PlayersTurnSign");
        canvas         = GameObject.Find("UICanvas");

        nextUpSignPanel        = canvas.transform.GetChild(2).gameObject;
        nextUpSignSpriteObject = nextUpSignPanel.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.transform.GetChild(0).gameObject;
        nextPieceSprite        = nextUpSignSpriteObject.GetComponent <Image>();
        turnsLeftSign          = canvas.transform.GetChild(1).gameObject;

        nextUpSignPanel.SetActive(false);

        turnsLeft = 20;
        updateTurnsSign();

        defenseTroopPlacement = 0;
        defenseTrapPlacement  = 0;
        attackSpecialistNum   = 0;
        hasGuard     = false;
        hasBerserker = false;
    }
示例#15
0
    public void SkipCheckBeforeExecute(int dicevalue)
    {
        m_presentedDiceValue = dicevalue;
        PlayerMovement currentPlayerScript = GameObject.FindGameObjectWithTag(m_currentPlayerTurn.ToString()).GetComponent <PlayerMovement>();

        if (m_presentedDiceValue == 6)
        {
            if (currentPlayerScript.previousRecordedValue == 6)
            {
                //skip this turn do  not move
                m_currentPlayerTurn = SwitchTurns(m_currentPlayerTurn);
                return;
            }
        }

        if (!currentPlayerScript.hasAlreadySkipped)
        {
            if (currentPlayerScript.hasSkippedPreviousTurn)
            {
                m_presentedDiceValue += currentPlayerScript.previousRecordedValue;
                currentPlayerScript.hasAlreadySkipped = true;
            }
            //showpanel for skipth thing and stat coroutine for this after some time let say 2 seconds and we will give a single second to skip the turn.
            SkipPanel.SetActive(true);
            Invoke("HideSkipPanel", 1.5f);
        }
        //show button to skip that thing.
        StartCoroutine(StartExecution(m_presentedDiceValue, 2f));
    }
示例#16
0
    IEnumerator StartExecution(int diceValue, float time)
    {
        yield return(new WaitForSecondsRealtime(time));

        switch (m_currentPlayerTurn)
        {
        case PlayerTurn.PlayerRed:
        {
            yield return(StartCoroutine(GameObject.FindGameObjectWithTag("PlayerRed").GetComponent <PlayerMovement>().StartExecution(diceValue)));
        }
        break;

        case PlayerTurn.PlayerBlue:
        {
            yield return(StartCoroutine(GameObject.FindGameObjectWithTag("PlayerBlue").GetComponent <PlayerMovement>().StartExecution(diceValue)));
        }
        break;

        case PlayerTurn.PlayerYellow:
        {
            yield return(StartCoroutine(GameObject.FindGameObjectWithTag("PlayerYellow").GetComponent <PlayerMovement>().StartExecution(diceValue)));
        }
        break;

        case PlayerTurn.PlayerGreen:
        {
            yield return(StartCoroutine(GameObject.FindGameObjectWithTag("PlayerGreen").GetComponent <PlayerMovement>().StartExecution(diceValue)));
        }
        break;
        }

        m_currentPlayerTurn = SwitchTurns(m_currentPlayerTurn);
    }
示例#17
0
    public PlayerTurn PlayTurn(PlayerTurn previousTurn, CardDeck drawPile)
    {
        PlayerTurn turn = new PlayerTurn();

        if (previousTurn.Result == TurnResult.Skip ||
            previousTurn.Result == TurnResult.DrawTwo ||
            previousTurn.Result == TurnResult.WildDrawFour)
        {
            return(ProcessAttack(previousTurn.Card, drawPile));
        }
        else if ((previousTurn.Result == TurnResult.WildCard ||
                  previousTurn.Result == TurnResult.Attacked ||
                  previousTurn.Result == TurnResult.ForceDraw) &&
                 HasMatch(previousTurn.DeclaredColor))
        {
            turn = PlayMatchingCard(previousTurn.DeclaredColor);
        }
        else if (HasMatch(previousTurn.Card))
        {
            turn = PlayMatchingCard(previousTurn.Card);
        }
        else //Draw a card and see if it can play
        {
            turn = DrawCard(previousTurn, drawPile);
        }

        DisplayTurn(turn);
        return(turn);
    }
示例#18
0
 public void Initialize()
 {
     _errorGO            = GameObject.Find("ErrorGO");
     _errorText          = GameObject.Find("losText").GetComponent <Text>();
     _player             = GameObject.Find("Player");
     _playerTurn         = _player.GetComponent <PlayerTurn>();
     _apBar              = GameObject.Find("APbar");
     _apRect             = _apBar.GetComponent <RectTransform>();
     _apBack             = GameObject.Find("APback").GetComponent <RectTransform>();
     _hpBar              = GameObject.Find("HPbar");
     _hpRect             = _hpBar.GetComponent <RectTransform>();
     _hpBack             = GameObject.Find("HPback").GetComponent <RectTransform>();
     _apLoss             = GameObject.Find("APLoss");
     _apLossRect         = _apLoss.GetComponent <RectTransform>();
     _apImage            = _apLoss.GetComponent <Image>();
     _moveIndicator      = GameObject.Find("Player").GetComponent <MoveIndicator>();
     _toolTip            = gameObject.GetComponent <Tooltip>();
     _moveCost           = GameObject.Find("MoveCost").GetComponent <Text>();
     _moveButton         = GameObject.Find("ToggleMove").GetComponent <Button>();
     _toggleAttackButton = GameObject.Find("ToggleAttack").GetComponent <Button>();
     _attackAbutton      = GameObject.Find("AttackTypeA").GetComponent <Button>();
     _attackBbutton      = GameObject.Find("AttackTypeB").GetComponent <Button>();
     _attackCbutton      = GameObject.Find("AttackTypeC").GetComponent <Button>();
     _calc     = GameObject.Find("_combatMan").GetComponent <CalculateDamage>();
     _auxPower = GameObject.Find("_combatMan").GetComponent <AuxilliaryPower>();
     _hpap     = GameObject.Find("HP/AP");
     _hpapText = GameObject.Find("HP/AP Text").GetComponent <Text>();
     _hpap.SetActive(false);
     _pauseMenu = GameObject.Find("PauseMenu");
     _errorGO.SetActive(false);
     _pauseMenu.SetActive(false);
     DeactivateButtons(false);
     UpdateHealth();
 }
示例#19
0
    private void DisplayTurn(PlayerTurn currentTurn)
    {
        if (currentTurn.Result == TurnResult.ForceDraw)
        {
            Console.WriteLine("Player " + Position.ToString() + " is forced to draw.");
        }
        if (currentTurn.Result == TurnResult.ForceDrawPlay)
        {
            Console.WriteLine("Player " + Position.ToString() + " is forced to draw AND can play the drawn card!");
        }

        if (currentTurn.Result == TurnResult.PlayedCard ||
            currentTurn.Result == TurnResult.Skip ||
            currentTurn.Result == TurnResult.DrawTwo ||
            currentTurn.Result == TurnResult.WildCard ||
            currentTurn.Result == TurnResult.WildDrawFour ||
            currentTurn.Result == TurnResult.Reversed ||
            currentTurn.Result == TurnResult.ForceDrawPlay)
        {
            Console.WriteLine("Player " + Position.ToString() + " plays a " + currentTurn.Card.DisplayValue + " card.");
            if (currentTurn.Card.Color == CardColor.Wild)
            {
                Console.WriteLine("Player " + Position.ToString() + " declares " + currentTurn.DeclaredColor.ToString() + " as the new color.");
            }
            if (currentTurn.Result == TurnResult.Reversed)
            {
                Console.WriteLine("Turn order reversed!");
            }
        }

        if (Hand.Count == 1)
        {
            Console.WriteLine("Player " + Position.ToString() + " shouts Uno!");
        }
    }
示例#20
0
 void StartPlayerTurn()
 {
     GameObject.Find("CurrentTurnText").GetComponent <Text>().text =
         defautTurnText + "You";
     playerTurn = gameObject.AddComponent <PlayerTurn>() as PlayerTurn;
     GameObject.Find("CurrentTurnText").GetComponent <Text>().text = defautTurnText + "You";
 }
 void Update()
 {
     if (!t.flashlightOn)
     {
         stunt = false;
         t.SetNotEmpty();
         anim.SetBool("Stunt", false);
         //1st trigger statement
         if (PlayerTurn.ghostFinished[ghostIndex])
         {
             CheckPlayer();
             PlayerTurn.SetGhostTurn(ghostIndex);
         }
         //2nd trigger statement (game over)
         else if (eat)
         {
             Move();
         }
     }
     else
     {
         if (!triggered && PlayerTurn.ghostFinished[ghostIndex])
         {
             CheckPlayer();
         }
         stunt = true;
         anim.SetBool("Stunt", true);
         PlayerTurn.SetGhostTurn(ghostIndex);
     }
 }
示例#22
0
 void Start()
 {
     _pT                  = GameObject.Find("Player").GetComponent <PlayerTurn>();
     _anim                = gameObject.GetComponent <Animator>();
     _coverCanvas         = transform.parent.FindChild("Canvas").GetComponent <Canvas>();
     _coverCanvas.enabled = false;
 }
示例#23
0
 // Use this for initialization
 void Start()
 {
     _line    = gameObject.GetComponent <LineRenderer>();
     _moveInd = GameObject.Find("Indicator");
     _moveMat = _moveInd.GetComponent <Renderer>().material;
     _pT      = gameObject.GetComponent <PlayerTurn>();
 }
示例#24
0
 private void playToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!m_bGameStarted)
     {
         m_bGameStarted = true;
         eTurn          = PlayerTurn.Player1;
     }
     else
     {
         if (!m_bGameWon)
         {
             //Message to warn of game restart.
             MessageBox pDlg = new MessageBox("Game in Progress!", "You are about to restart your game.  Do you wish to continue?");
             pDlg.ShowDialog();
             if (!pDlg.bContinue)
             {
                 return;
             }
         }
         m_bGameWon     = false;
         m_bGameStarted = true;
         eTurn          = PlayerTurn.Player1;
         createDictionary();
         lbl1.Image     = lbl2.Image = lbl3.Image = lbl4.Image = lbl5.Image =
             lbl6.Image = lbl7.Image = lbl8.Image = lbl9.Image = null;
     }
     updateTurnLabel();
 }
示例#25
0
        void newGame()
        {
            //this is used to make resetting the game easier
            PictureBox[] AllPictures =
            {
                pictureBox0,
                pictureBox1,
                pictureBox2,
                pictureBox3,
                pictureBox4,
                pictureBox5,
                pictureBox6,
                pictureBox7,
                pictureBox8,
            };

            //clear all the cells.
            foreach (var p in AllPictures)
            {
                p.Image = null;
            }

            turn   = PlayerTurn.TurnP1;
            winner = Winner.None;
            Show_Status();
        }
示例#26
0
    public void win(PlayerTurn player)
    {
        winningPlayer = player;
        // Destroy what GameStateManager doesn't need; destroy the rest at Win/Loss screen.
        Pawn[] ps = FindObjectsOfType <Pawn>();
        foreach (Pawn p in ps)
        {
            p.destroyPawn();
        }

        Heap[] hs = FindObjectsOfType <Heap>();
        foreach (Heap h in hs)
        {
            h.destroyHeap();
        }

        Board board = FindObjectOfType <Board> ();

        board.destroyBoard();

        Debug.Log(winningPlayer + " won the game.");

        LevelManager lm = FindObjectOfType <LevelManager> ();

        lm.LoadLevel("End");
    }
示例#27
0
    void Start()
    {
        Color[] g_scale = newSprite.GetPixels();
        float[] n       = new float[g_scale.Length];
        for (int i = 0; i < n.Length; ++i)
        {
            n[i] = g_scale[i].grayscale;
        }

        lst_cross = new List <GameObject>();
        turn      = PlayerTurn.Black;
        Board     = new GameObject[8, 8];

        int g_cnt = 0;

        for (int i = 0; i < 8; ++i)
        {
            for (int j = 0; j < 8; ++j)
            {
                Board[i, j] = Instantiate(p_Board_Piece, transform);
                Board[i, j].transform.localPosition = new Vector3(-3.5f + i, 3.5f - j, g_scale[g_cnt++].grayscale);
            }
        }

        Board[3, 3].GetComponent <Board_Piece>().ChangeDisk(global::Board_Piece.BoardState.White, p_Disk);
        Board[4, 4].GetComponent <Board_Piece>().ChangeDisk(global::Board_Piece.BoardState.White, p_Disk);
        Board[4, 3].GetComponent <Board_Piece>().ChangeDisk(global::Board_Piece.BoardState.Black, p_Disk);
        Board[3, 4].GetComponent <Board_Piece>().ChangeDisk(global::Board_Piece.BoardState.Black, p_Disk);

        SetCrossHair();
    }
示例#28
0
    /**
     * Super simple evaluation function
     */
    private int eval(PlayerTurn t, PieceType[,] board)
    {
        int ret = 0;

        for (int i = 0; i < 8; i++)
        {
            for (int j = 0; j < 8; j++)
            {
                if (board[i, j] == chooseFriendlyPiece(t))
                {
                    // Corners
                    if ((i == 0 && j == 0) ||
                        (i == 0 && j == 7) ||
                        (i == 7 && j == 0) ||
                        (i == 7 && j == 7))
                    {
                        ret += 4;
                    }
                    // Edges
                    else if (i == 0 || i == 7 || j == 0 || j == 7)
                    {
                        ret += 2;
                    }
                    // Regular Spaces
                    else
                    {
                        ret += 1;
                    }
                }
            }
        }

        return(ret);
    }
示例#29
0
    public void FinishGameImDead(CannonController deadController)
    {
        GameFinished = true;
        PlayerTurn playerWinner = deadController == player1 ? PlayerTurn.Player2 : PlayerTurn.Player1;

        GameUIManager.Instance.ShowGameFinishedMenus(playerWinner);
    }
示例#30
0
    private PlayerTurn ProcessAttack(Card currentDiscard, CardDeck drawPile)
    {
        PlayerTurn turn = new PlayerTurn();

        turn.Result        = TurnResult.Attacked;
        turn.Card          = currentDiscard;
        turn.DeclaredColor = currentDiscard.Color;
        if (currentDiscard.Value == CardValue.Skip)
        {
            Console.WriteLine("Player " + Position.ToString() + " was skipped!");
            return(turn);
        }
        else if (currentDiscard.Value == CardValue.DrawTwo)
        {
            Console.WriteLine("Player " + Position.ToString() + " must draw two cards!");
            Hand.AddRange(drawPile.Draw(2));
        }
        else if (currentDiscard.Value == CardValue.DrawFour)
        {
            Console.WriteLine("Player " + Position.ToString() + " must draw four cards!");
            Hand.AddRange(drawPile.Draw(4));
        }

        return(turn);
    }
示例#31
0
        public void MakeNextPlayerTurn(ACard dealerCard)
        {
            if (!(numberOfMoves == 0 && GetSumOfCards() == 21))
            {
                PlayerTurnNow = GetNextTurn(dealerCard);
            }

            else if (dealerCard.CardName == CardNames.Ace)
            {
                PlayerTurn answer = GetAnswerAfterFirstBlackjack();
                if (answer == PlayerTurn.Take)
                {
                    PlayerTurnNow = PlayerTurn.Take;
                }
                else
                {
                    MakeBlackjackMultiplayer();
                    PlayerTurnNow = PlayerTurn.Stand;
                }
            }

            else
            {
                MakeBlackjackMultiplayer();
                PlayerTurnNow = dealerCard.CardNumber == 10 ? PlayerTurn.Stand : PlayerTurn.Blackjack;
            }
        }
示例#32
0
        protected override void Initialize()
        {
            _graphics.PreferredBackBufferWidth  = 600; // set this value to the desired width of your window
            _graphics.PreferredBackBufferHeight = 600; // set this value to the desired height of your window
            _graphics.ApplyChanges();

            _currentPlayerTurn = PlayerTurn.RedTurn;

            _currentGameState = GameState.TurnBeginning;

            _gameTable = new int[8, 8]
            {
                { 1, 0, 1, 0, 1, 0, 1, 0 },
                { 0, 1, 0, 1, 0, 1, 0, 1 },
                { 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0 },
                { -1, 0, -1, 0, -1, 0, -1, 0 },
                { 0, -1, 0, -1, 0, -1, 0, -1 }
            };

            _possibleClicked = new List <Point>();

            base.Initialize();
        }
        public FightClubSimulatorGame()
        {
            currentPlayerTurn = PlayerTurn.PlayerOneTurn;
            playerOne = new FightClubPlayer();
            playerTwo = new FightClubPlayer();

            // Set the player name's to the default Player One and Player Two
            PlayerOne.Name = "Player One";
            PlayerTwo.Name = "Player Two";
        }
示例#34
0
    public GameObject DropDisc(int row, int col, ref Cell cell)
    {
        if (playerTurn != PlayerTurn.None)
        {
            GameObject disc = null;

            if (playerTurn == PlayerTurn.Red)
            {
                disc = Instantiate(RedDisc) as GameObject;
                currentState[row, col] = 1;
                cell.value = 1;
                playerTurn = PlayerTurn.Black;
            }
            else if (playerTurn == PlayerTurn.Black)
            {
                disc = Instantiate(BlackDisc) as GameObject;
                currentState[row, col] = 0;
                cell.value = 0;
                playerTurn = PlayerTurn.Red;
            }
            disc.transform.position = new Vector3(cell.transform.position.x,
                                                  BoardGenerator.boardCells[GameManager.boardHeight - 1, col].transform.position.y + 1,
                                                  cell.transform.position.z);

            UpdateTurnText();

            /*for (int r = 0; r < BoardGenerator.currentBoardValues.GetLength(0); r++)
            {
                string rowInfo = "";
                for (int c = 0; c < BoardGenerator.currentBoardValues.GetLength(1); c++)
                {
                    string delimiter = c == BoardGenerator.currentBoardValues.GetLength(1) - 1 ? "" : ", ";
                    rowInfo += BoardGenerator.currentBoardValues[r, c] + delimiter;
                }
                Debug.Log(rowInfo);
            }
            Debug.Log("\n\n");*/

            return disc;
        }
        return null;
    }
示例#35
0
        private int NodeEval(CardClass[,] ms, PlayerTurn currTurn, Vector2 cardStart, Vector2 cardEnd, int depth)
        {
            int score = 0;
            Turn activeTurn = map.GetTurn(currTurn);
            Turn otherTurn = map.GetTurn(currTurn == PlayerTurn.Player1 ? PlayerTurn.Player2 : PlayerTurn.Player1);
            CardClass cc = null;
            bool foundActive = false;
            bool foundOther = false;
            int win_value = WinValue - 10 * depth;
            int dis = 0;
            for (int i = 0; i < ms.GetLength(0); i++)
            {
                for (int j = 0; j < ms.GetLength(1); j++)
                {
                    cc = ms[i, j];

                    if (cc != null && cc.GetCardType().player == currTurn)
                    {
                        foundActive = true;
                        score += cc.GetCardType().GetStat() + cc.GetCardType().numberOfMoves + cc.GetCardType().weight;
                        dis = Math.Abs(otherTurn.GateLane() - i) + Math.Abs(3 - j);
                        if (dis == 0)
                            score += win_value;
                        else
                            score += (int)(moveValue * (1.0f /dis));
                    }
                    else if (cc != null)
                    {
                        foundOther = true;
                        score -= cc.GetCardType().GetStat() - cc.GetCardType().numberOfMoves - cc.GetCardType().weight;
                        dis = Math.Abs(activeTurn.GateLane() - i) + Math.Abs(3 - j);
                        if (dis == 0)
                            score -= win_value;
                        else
                            score -= (int)(moveValue * (1.0f / dis));
                    }
                }
            }

            // Add for loop for the hands to sum them.

            foreach (CardClass c in hand.GetCardList())
            {
                score += c.GetCardType().GetStat() + c.GetCardType().numberOfMoves + c.GetCardType().weight;
            }

            foreach (CardClass c in otherTurn.GetHand().GetCardList())
            {
                score -= c.GetCardType().GetStat() - c.GetCardType().numberOfMoves - c.GetCardType().weight;
            }

            if (!foundActive && hand.Count == 0)
                score -= win_value;

            if (!foundOther && otherTurn.HandCount() == 0)
                score -= win_value;

            return score;// *(currTurn == PlayerTurn.Player2 ? 1 : -1);
        }
示例#36
0
 public Turn GetTurn(PlayerTurn pt)
 {
     if (turns[0].GetPlayerTurn() == pt)
         return turns[0];
     else
         return turns[1];
 }
    // Use this for initialization
    void Start()
    {
        instance = this;

        hasResed = false;
        player1space = false;
        player2space = false;

        player1Hand = new Card[5];
        player2Hand = new Card[5];

        Deck deck = GameObject.FindGameObjectWithTag("Deck").GetComponent<Deck>();
        deck.InitDeck();

        for (int i = 0; i < 5; i++)
        {
            player1Hand[i] = deck.GetNextCard();
            player1Hand[i].flipped = false;
            player1Hand[i].belongsTo = PlayerTurn.Player1;

            player2Hand[i] = deck.GetNextCard();
            player2Hand[i].flipped = false;
            player2Hand[i].belongsTo = PlayerTurn.Player2;
        }

        RotateCards();
        ChangeBackground();
        ChangeBackground();

        Player1Score.player1score = 0;
        Player2Score.player2score = 0;

        NotificationList.instance.AddItem("Press Esc at any time to view the Help Menu.");

        // pick a random player to start
        int random = (int)Random.Range (0, 2);
        GameObject button = GameObject.FindGameObjectWithTag ("TurnButton");
        switch (random) {
        case 0:
            whichTurn = PlayerTurn.Player2;
            button.GetComponent<TurnButton>().OnMouseDown();
            break;
        case 1:
            whichTurn = PlayerTurn.Player1;
            button.GetComponent<TurnButton>().OnMouseDown();
            break;
        default:
            break;
        }
    }
示例#38
0
 private void HandleBlackTurnForAIPlayer()
 {
     List<GamePieceMove> aiMoves = ai.GetAIMoves(gameBoard.CloneBoard());
     foreach(GamePieceMove move in aiMoves)
         gameBoard.ApplyMove(move);
     gameTurn = PlayerTurn.WhiteTurn;
     if (IsGameOver())
     {
         gameState = GameStates.GameOver;
         winner = PlayerColours.Black;
     }
 }
示例#39
0
 private void CompleteCurrentTurn(PlayerColours currentPlayerColour)
 {
     if (IsGameOver())
     {
         gameState = GameStates.GameOver;
         winner = currentPlayerColour;
     }
     else
     {
         gameTurn = GetWhosTurnIsIt(gameTurn);
         UnSelectPiece();
         gameState = GameStates.Playing;
     }
 }
示例#40
0
        private bool PlaceCard(CardClass card, int x, int y, int transX, int transY, uint ID, bool place)
        {
            if ( x >= 0 && y >= 0 && x < map.GetLength(1) && y < map.GetLength(0))
            {
                CardClass replacedCard = map[y, x];
                CardClass winner = card;
                int modifier = 0;
                bool forwardMove = false;
                if (!(transX == 0 && transY == 0))
                {
                    modifier = card.GetMove()[transY, transX].modifier;
                    forwardMove = card.GetMove()[transY, transX].y == transX;
                }

                if (replacedCard != null && replacedCard.player != card.player)
                    // Check to see which one wins in this battle.
                    winner = replacedCard.GetCardType().GetStat() <= card.GetCardType().GetStat() + modifier ? card : replacedCard;
                else if (replacedCard != null)
                {
                    string type = card.GetCardType().typeName.Substring(0, card.GetCardType().typeName.Length - 1);
                    string replaceType = replacedCard.GetCardType().typeName.Substring(0, replacedCard.GetCardType().typeName.Length - 1);
                    string lastLetter = card.GetCardType().typeName.Substring(card.GetCardType().typeName.Length - 1);
                    if (type.Equals("Soldier") && replaceType.Equals("Soldier") && place)
                    {
                        foreach (CardType ct in cardTypes)
                        {
                            if (ct.typeName.ToLower().ToString().Equals("stack" + lastLetter.ToLower()))
                            {
                                winner = new CardClass(ct, card.player);
                                winner.SetLocation(replacedCard.GetLoc(), true);
                                break;
                            }
                        }

                        if (winner == null)
                            return false;
                    }
                    else
                        // tried to move onto own card.
                        return false;
                }

                if (y == activeTurn.GateLane())
                    return false;

                // Check for movement into the gates
                Turn other = turns.Find(delegate(Turn t) { return t != activeTurn; });
                if (other != null && y == other.GateLane())
                {
                    if (!forwardMove || x != 3)
                    {
                        return false;
                    }
                }

                Vector2 oldLoc = ConvertScreenCoordToMap(card.GetPrevLocation());
                // Cards can't move into their old position.
                if ((int)oldLoc.X == x && (int)oldLoc.Y == y)
                    return false;

                if (place)
                {
                    MoveList ml = new MoveList();
                    ml.moveID = ID;
                    ml.movedCard = card;
                    ml.replacedCard = (winner == replacedCard ? card : replacedCard);
                    ml.cardPrevLoc = winner.GetPrevLocation();
                    Vector2 newLoc = center + new Vector2(x * (CardClass.cardWidth + spacing), y * (CardClass.cardHeight + spacing));
                    ml.toLoc = newLoc;
                    ml.startLoc = winner.GetLoc();

                    moveStack.Push(ml);
                    map[y, x] = winner;
                    Vector2 clear = ConvertScreenCoordToMap(card.GetLoc());
                    if (clear.Y >= 0 && clear.X >= 0)
                        map[(int)clear.Y, (int)clear.X] = null;
                    winner.SetLocation(newLoc, true);

                    if (card.player == PlayerTurn.Player1)
                        turns[0].RemoveCardFromHand(card);
                    else if (card.player == PlayerTurn.Player2)
                        turns[1].RemoveCardFromHand(card);
                }

                return (place ? true : winner == card);
            }

            return false;
        }
示例#41
0
        public MapView(string n, GraphicsDevice gd)
            : base(n)
        {
            // This would be where to create the map of whatever size. We are starting with 5 by 5, but the gate is out of that.
            // So we need an extra one on both sides. The other extras will just be marked as filled by something.
            map = new CardClass[7, 7];

            turns.Add(new Turn1(map.GetLength(1), map.GetLength(0)));
            if (type == GameType.Player1)
                turns.Add(new AITurn(map.GetLength(1), map.GetLength(0), this));
            else
                turns.Add(new Turn2(map.GetLength(1), map.GetLength(0)));

            cardTypes = new List<CardType>();

            activeTurn = turns[0];
            winner = 0;

            moveStack = new Stack<MoveList>();
            movementSteps = new Stack<MoveSteps>(3);

            SetCenter(new Vector2((gd.Viewport.Width - CardClass.cardWidth * map.GetLength(1)) / 2, (gd.Viewport.Height - CardClass.cardHeight * map.GetLength(1)) / 2));
        }
示例#42
0
 public void DrawWhosTurnLabel(SpriteBatch spriteBatch, GameType gameType, PlayerTurn playerTurn)
 {
     if (gameType == GameType.OnePlayer)
         DrawWhosTurnLabelForOnePlayerGame(spriteBatch, playerTurn);
     else
         DrawWhosTurnLabelForTwoPlayerGame(spriteBatch, playerTurn);
 }
示例#43
0
 private void DrawWhosTurnLabelForTwoPlayerGame(SpriteBatch spriteBatch, PlayerTurn playerTurn)
 {
     spriteBatch.Begin();
     if (playerTurn == PlayerTurn.WhiteTurn)
         spriteBatch.Draw(playerOneTurn, new Rectangle(90, 580, 320, 50), Color.White);
     else
         spriteBatch.Draw(playerTwoTurn, new Rectangle(90, 580, 320, 50), Color.White);
     spriteBatch.End();
 }
示例#44
0
        private void OnReceive(IAsyncResult ar)
        {
            #region Local variables / converting received message
            try
            {
                Socket clientSocket = (Socket)ar.AsyncState;
                clientSocket.EndReceive(ar);
                //Transform the array of bytes received from the user into an
                //intelligent form of object Data
                Data msgReceived = new Data(byteData);
                //We will send this object in response the users request
                Data msgToSend = new Data();
                byte[] message;
                //If the message is to login, logout, or simple text message
                //then when send to others the type of the message remains the same
                msgToSend.cmdCommand = msgReceived.cmdCommand;
                msgToSend.strName = msgReceived.strName;
            #endregion
               
                
                    #region Command.NewGame
                
                if (msgReceived.cmdCommand == Command.NewGame)
                {
                    newGameCount = 0;
                    NewGame();
                    msgToSend.cmdCommand = Command.NewGame;
                    message = msgToSend.ToByte();
                            foreach (ClientInfo clientInfo in clientList)
                            {
                                if (clientInfo.socket != clientSocket ||
                                    msgToSend.cmdCommand != Command.Login)
                                {
                                    //Send the message to all users
                                    clientInfo.socket.BeginSend(message, 0, message.Length, SocketFlags.None,
                                        new AsyncCallback(OnSend), clientInfo.socket);
                                }
                            }
                            RaiseEvent("Both players have agreed to start a new game. \r\n");
                }
                    #endregion
                else
                {
                #region Make Move Command              
                if (msgReceived.cmdCommand == Command.MakeMove)//MAKE A METHOD HERE TO CHECK AN ARRAY LIST FOR VALID MOVES
                //IF IT IS A VALID MOVE THEN MAKE CHANGES TO ARRAY TO REFLECT THE MOVE THAT WAS MADE
                {
                   RaiseEvent("strMessage: " + msgReceived.strMessage + Environment.NewLine + "cmdCommand: " + msgReceived.cmdCommand.ToString() + Environment.NewLine + "strName: " + msgReceived.strName.ToString() + Environment.NewLine);               
                    msgReceived.cmdCommand = Command.Message;
                    if (CheckValidity(ColumnCheck(Convert.ToInt32(msgReceived.strMessage))))
                    {//if true, means that there is still space in the column to put a chip
                        int currentrow = RowCorrect(ColumnCheck(Convert.ToInt32(msgReceived.strMessage)));
                        int currentcolumn = Convert.ToInt32(msgReceived.strMessage) - 1;
                        MoveToSend = turn.ToString() + "," + currentcolumn + "," + currentrow;
                        if (turn == PlayerTurn.Black)
                        {
                            zonelist[currentcolumn, currentrow] = ChipColor.Black;
                            turn = PlayerTurn.Red;
                        }
                        else
                        {
                            zonelist[currentcolumn, currentrow] = ChipColor.Red;
                            turn = PlayerTurn.Black;
                        }                       
                        msgReceived.cmdCommand = Command.SendMove;
                        RowIncrease(currentcolumn);
                        if (CheckWin())
                        {
                            msgToSend.cmdCommand = Command.Win;
                            msgToSend.strMessage = MoveToSend + "," + winningCombination;
                            //make the last move of the game and announce the current player is the winner
                        }
                        else
                        {
                            if (turn == PlayerTurn.Black)
                                turn = PlayerTurn.Red;
                            else
                                turn = PlayerTurn.Black;
                            //make a command here to change the player's boards and also change current turn
                        }     
                        if (turn == PlayerTurn.Black)
                            turn = PlayerTurn.Red;
                        else
                            turn = PlayerTurn.Black;
                    }
                    else//need to add a command in here to return an invalid move message to the player
                    {
                        ValidorInvalidMove = false;
                        msgToSend.cmdCommand = Command.Message;
                        msgToSend.strMessage = "The column you selected is not a valid move. Try again.";
                    }
                }
                #endregion
                if (ValidorInvalidMove)//only relevant if player did not make a move or made a valid move
                {
                    if (msgToSend.cmdCommand != Command.Win)
                    {
                        switch (msgReceived.cmdCommand)
                        {
                            #region Login Command
                            case Command.Login:
                                //When a user logs in to the server then we add her to our
                                //list of clients
                                ClientInfo clientInfo = new ClientInfo();
                                clientInfo.socket = clientSocket;
                                clientInfo.strName = msgReceived.strName;
                                Random rnd = new Random();
                                if (clientList.Count == 0)
                                {
                                    if (rnd.Next(0, 2) == 0)
                                    {
                                        clientInfo.strName = "Black";
                                        playerBlackSocket = clientSocket;
                                    }
                                    else
                                    {
                                        clientInfo.strName = "Red";
                                        playerRedSocket = clientSocket;
                                    }
                                    colorDif = clientInfo.strName;
                                }
                                else if (clientList.Count == 1)
                                {
                                    if (colorDif == "Black")
                                    {
                                        clientInfo.strName = "Red";
                                        playerRedSocket = clientSocket;
                                    }
                                    else
                                    {
                                        clientInfo.strName = "Black";
                                        playerBlackSocket = clientSocket;
                                    }
                                    msgToSend.cmdCommand = Command.BeginGame;
                                    msgToSend.strMessage = "first";
                                    message = msgToSend.ToByte();
                                    playerBlackSocket.BeginSend(message, 0, message.Length, SocketFlags.None,
                                            new AsyncCallback(OnSend), playerBlackSocket);
                                    msgToSend.strMessage = "second";
                                    message = msgToSend.ToByte();
                                    playerRedSocket.BeginSend(message, 0, message.Length, SocketFlags.None,
                                            new AsyncCallback(OnSend), playerRedSocket);

                                    
                                msgToSend.cmdCommand = Command.List;
                                msgToSend.strName = null;
                                msgToSend.strMessage = null;
                                //Collect the names of the user in the chat room
                                foreach (ClientInfo client in clientList)
                                {
                                    //To keep things simple we use asterisk as the marker to separate the user names
                                    msgToSend.strMessage += client.strName + "*";
                                    message = msgToSend.ToByte();
                                }
                                    
                                }
                                else if(clientList.Count ==2)
                                {
                                    clientSocket.Disconnect(false);
                                    break;
                                }
                                if (clientList.Count <= 2)
                                {
                                    msgReceived.strName = clientInfo.strName;
                                    clientList.Add(clientInfo);
                                    //Set the text of the message that we will broadcast to all users
                                    msgToSend.strMessage = "<<<" + msgReceived.strName + " has joined the room>>>";
                                }
                                break;
                            #endregion
                            #region Logout Command
                            case Command.Logout:
                                //When a user wants to log out of the server then we search for her 
                                //in the list of clients and close the corresponding connection
                                int nIndex = 0;
                                foreach (ClientInfo client in clientList)
                                {
                                    if (client.socket == clientSocket)
                                    {
                                        clientList.RemoveAt(nIndex);
                                        break;
                                    }
                                    ++nIndex;
                                }
                                clientSocket.Close();
                                msgToSend.strMessage = "<<<" + msgReceived.strName + " has left the room>>>";
                                break;
                            #endregion
                            #region Message Command
                            case Command.Message:
                                //Set the text of the message that we will broadcast to all users
                                msgToSend.strMessage = msgReceived.strName + ": " + msgReceived.strMessage;
                                break;
                            #endregion
                            #region Win Command
                            case Command.Win:
                                msgToSend.cmdCommand = Command.SendMove;
                                msgToSend.strMessage = MoveToSend + "," + winningCombination;
                                message = msgToSend.ToByte();
                                foreach (ClientInfo client in clientList)
                                {
                                 
                                        if (client.socket != clientSocket ||
                                        msgToSend.cmdCommand != Command.Login)
                                    {
                                        //Send the message to all users
                                        client.socket.BeginSend(message, 0, message.Length, SocketFlags.None,
                                            new AsyncCallback(OnSend), client.socket);
                                    }
                                }
                                break;
                            #endregion
                            #region Send Moves
                            case Command.SendMove:
                                msgToSend.cmdCommand = Command.SendMove;
                                msgToSend.strMessage = MoveToSend;
                                message = msgToSend.ToByte();
                                foreach (ClientInfo client in clientList)
                                {
                                    if (client.socket != clientSocket ||
                                        msgToSend.cmdCommand != Command.Login)
                                    {
                                        //Send the message to all users
                                        client.socket.BeginSend(message, 0, message.Length, SocketFlags.None,
                                            new AsyncCallback(OnSend), client.socket);
                                    }
                                }
                                break;
                            #endregion
                            #region List Command
                            case Command.List:
                                //Send the names of all users in the chat room to the new user
                                msgToSend.cmdCommand = Command.List;
                                msgToSend.strName = null;
                                msgToSend.strMessage = null;
                                //Collect the names of the user in the chat room
                                foreach (ClientInfo client in clientList)
                                {
                                    //To keep things simple we use asterisk as the marker to separate the user names
                                    msgToSend.strMessage += client.strName + "*";
                                    message = msgToSend.ToByte();
                                    //Send the name of the users in the chat room
                                    
                                    //clientSocket.BeginSend(message, 0, message.Length, SocketFlags.None,
                                          //  new AsyncCallback(OnSend), clientSocket);
                                }
                                foreach (ClientInfo client in clientList)
                                {
                                    message = msgToSend.ToByte();
                                    client.socket.BeginSend(message, 0, message.Length, SocketFlags.None,
                                                new AsyncCallback(OnSend), client.socket);

                                }

                                break;
                            #endregion
                        }
                        #region Send message to all clients
                        if (msgToSend.cmdCommand != Command.List && msgToSend.cmdCommand != Command.SendMove && msgToSend.cmdCommand != Command.BeginGame)   //List messages are not broadcasted
                        {
                            message = msgToSend.ToByte();
                            foreach (ClientInfo clientInfo in clientList)
                            {
                                if (clientInfo.socket != clientSocket ||
                                    msgToSend.cmdCommand != Command.Login)
                                {
                                    //Send the message to all users
                                    clientInfo.socket.BeginSend(message, 0, message.Length, SocketFlags.None,
                                        new AsyncCallback(OnSend), clientInfo.socket);
                                }
                            }
                            RaiseEvent(msgToSend.strMessage + "\r\n");
                        }
                        #endregion
                    } 
                }
                #region Win / Game Over
                if (msgToSend.cmdCommand == Command.Win)
                {
                    message = msgToSend.ToByte();
                    foreach (ClientInfo clientInfo in clientList)
                    {
                        if (clientInfo.socket != clientSocket ||
                            msgToSend.cmdCommand != Command.Login)
                        {
                            //Send the message to all users
                            clientInfo.socket.BeginSend(message, 0, message.Length, SocketFlags.None,
                                new AsyncCallback(OnSend), clientInfo.socket);
                        }
                    }
                    RaiseEvent(msgToSend.strMessage + "\r\n");
                }
                #endregion
                #region Made an Invalid Move
                if(!ValidorInvalidMove)
                {
                    ValidorInvalidMove = true;
                    message = msgToSend.ToByte();
                    clientSocket.BeginSend(message, 0, message.Length, SocketFlags.None,
                                    new AsyncCallback(OnSend), clientSocket);
                    RaiseEvent(msgReceived.strName + " just made an invalid move! \r\n");
                }
                #endregion
                #region Begin Receive, Happens every time on receive
                //If the user is logging out then we need not listen from her
            }
                if (msgReceived.cmdCommand != Command.Logout)
                {
                    //Start listening to the message send by the user
                    clientSocket.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None, new AsyncCallback(OnReceive), clientSocket);
                }
            }
            catch (Exception ex)
            {
                RaiseEvent(ex.Message);
            }
        }
示例#45
0
    private void Awake()
    {
        startCombatState = new StartCombat(this);
        playerTurnState = new PlayerTurn(this);
        enemyTurnState = new EnemyTurn(this);
        battleLostState = new BattleLost(this);
        battleWonState = new BattleWon(this);
        blankState = new BlankState(this);
        currentState = blankState;

        missionButtonArray = GameObject.FindGameObjectsWithTag("MissionButton");
    }
示例#46
0
 protected new void Start()
 {
     base.Start();
     if(controlled) {
         hud = gameObject.AddComponent<HUD>();
         playerTurn = gameObject.AddComponent<PlayerTurn>();
         lu = gameObject.AddComponent<LevelUp>();
     }
     levelUpsAvailable += 19;
 }
示例#47
0
 public BaseAIPlayer(StrategoGame game, PlayerTurn playerColor)
     : base(game, playerColor)
 {
 }
示例#48
0
 public void DrawWhichColoursTurnItIsLabel(SpriteBatch spriteBatch, PlayerTurn playerTurn)
 {
     spriteBatch.Begin();
     if(playerTurn == PlayerTurn.WhiteTurn)
         spriteBatch.Draw(whiteTurn, new Rectangle(90, 620, 320, 50), Color.White);
     else
         spriteBatch.Draw(blackTurn, new Rectangle(90, 620, 320, 50), Color.White);
     spriteBatch.End();
 }
示例#49
0
 public RetreatAIPlayer(StrategoGame game, PlayerTurn playerColor)
     : base(game, playerColor)
 {
 }
示例#50
0
 public void DrawCommonGameElements(SpriteBatch spriteBatch,GameType gameType, PlayerTurn gameTurn)
 {
     DrawBackGround(spriteBatch);
     DrawBoard(spriteBatch);
     DrawDraughtPieces(spriteBatch);
     DrawWhosTurnLabel(spriteBatch, gameType, gameTurn);
     DrawWhichColoursTurnItIsLabel(spriteBatch, gameTurn);
 }
示例#51
0
        private bool PlayerCardsLeft(PlayerTurn pt)
        {
            foreach (CardClass card in map)
            {
                if (card != null && card.player == pt)
                    return true;
            }

            return false;
        }
示例#52
0
 public DecisionNode(int maxX, int maxY, PlayerTurn p)
 {
     children = new List<DecisionNode>(10);
     cardStart = new Vector2(-1, -1);
     cardEnd = new Vector2(-1, -1);
     cardPrevLoc = new Vector2(-1, -1);
     pt = p;
     Value = 0;
 }
示例#53
0
        private void CheckWin()
        {
            if ((turns[0].HandCount() == 0 && !PlayerCardsLeft(PlayerTurn.Player1)) || map[map.GetLength(0) - 1, 3] != null)
            {
                // player 2 wins by kill!
                winner = PlayerTurn.Player2;
                currState = GameState.GameOver;
            }

            if ((turns[1].HandCount() == 0 && !PlayerCardsLeft(PlayerTurn.Player2)) || map[0, 3] != null)
            {
                // player 1 wins by kill!
                winner = PlayerTurn.Player1;
                currState = GameState.GameOver;
            }
        }
示例#54
0
 public CardClass(CardType t, PlayerTurn pt)
 {
     type = t;
     loc = new Vector2(-1, -1);
     oldLoc = new Vector2(-1, -1);
 }
示例#55
0
 private PlayerTurn GetWhosTurnIsIt(PlayerTurn currentPlayer)
 {
     if (currentPlayer == PlayerTurn.BlackTurn)
         return PlayerTurn.WhiteTurn;
     else
         return PlayerTurn.BlackTurn;
 }
示例#56
0
 public Deck(PlayerTurn player)
 {
     deck = new Stack<CardClass>();
     owner = player;
 }
 public void FightSound(PlayerTurn player)
 {
     if (whichTurn == player)
     {
         SoundManager.instance.PlaySound("goodAttack", 1f);
     }
     else
     {
         SoundManager.instance.PlaySound("badAttack", 1f);
     }
 }
示例#58
0
 public Hand(PlayerTurn player)
 {
     hand = new List<CardClass>();
     owner = player;
     renderLoc = new Vector2(0, 0);
 }
示例#59
0
        public MapView()
            : base()
        {
            // This would be where to create the map of whatever size. We are starting with 5 by 5, but the gate is out of that.
            // So we need an extra one on both sides. The other extras will just be marked as filled by something.
            map = new CardClass[7,7];

            turns[0] = new Turn1(map.GetLength(0), map.GetLength(1));
            if (type == GameType.Player1)
                turns[1] = new AITurn(map.GetLength(0), map.GetLength(1), this);
            else
                turns[1] = new Turn2(map.GetLength(0), map.GetLength(1));

            cardTypes = new List<CardType>();
            moveStack = new Stack<MoveList>();

            activeTurn = turns[0];
            winner = 0;
        }
示例#60
0
 public BasePlayer(StrategoGame game, PlayerTurn playerColor)
 {
     _game = game;
     _playerColor = playerColor;
     IsRed = playerColor == PlayerTurn.Red;
 }