示例#1
0
 private void HandleGameModeChanged(GameModeChangedEvent e)
 {
     ClearMask();
     if (e.Current.Equals(GameMode.PlayerOneSetup))
     {
         GameManager.PlayerOne.Holder.SetActive(true);
         GameManager.PlayerTwo.Holder.SetActive(false);
     }
     else if (e.Current.Equals(GameMode.PlayerTwoSetup))
     {
         GameManager.PlayerOne.Holder.SetActive(false);
         GameManager.PlayerTwo.Holder.SetActive(true);
     }
     else if (e.Current.Equals(GameMode.PlayerOne))
     {
         MaskPlayer(GameManager.PlayerTwo);
     }
     else if (e.Current.Equals(GameMode.PlayerTwo))
     {
         MaskPlayer(GameManager.PlayerOne);
     }
     else if (e.Current.Equals(GameMode.PlayerTransition))
     {
         GameManager.PlayerOne.Holder.SetActive(true);
         GameManager.PlayerTwo.Holder.SetActive(true);
         ClearMask();
         MaskPlayer(GameManager.PlayerOne);
         MaskPlayer(GameManager.PlayerTwo);
     }
 }
示例#2
0
 private void HandleGameModeChanged(GameModeChangedEvent e)
 {
     if (e.Current.Equals(GameMode.PlayerTransition))
     {
         highlightCube.SetActive(false);
         previous = BoardPosition.OFF_BOARD;
         action   = false;
         ClearValid();
     }
 }
示例#3
0
 private void HandleGameModeChanged(GameModeChangedEvent e)
 {
     if (e.Current.Equals(GameMode.PlayerOneSetup) || e.Current.Equals(GameMode.PlayerTwoSetup))
     {
         UI.SetActive(true);
     }
     else if (e.Current.Equals(GameMode.PlayerTransition))
     {
         UI.SetActive(false);
     }
 }
示例#4
0
 private void HandleGameModeChanged(GameModeChangedEvent e)
 {
     if (e.Current.Equals(GameMode.PlayerOneSetup) || e.Current.Equals(GameMode.PlayerTwoSetup))
     {
         UI.SetActive(true);
     }
     else if (e.Current.Equals(GameMode.PlayerTransition))
     {
         UI.SetActive(false);
     }
 }
示例#5
0
    public void HandleGameModeChange(GameModeChangedEvent e)
    {
        if (!flagAtEnd.ContainsKey(GameManager.PlayerOne))
        {
            flagAtEnd.Add(GameManager.PlayerOne, 0);
        }
        if (!flagAtEnd.ContainsKey(GameManager.PlayerTwo))
        {
            flagAtEnd.Add(GameManager.PlayerTwo, 0);
        }

        if (e.Current.Equals(GameMode.PlayerTransition))
        {
            moveWithoutChallengeCount++;
            moveCount++;
        }
        else if (e.Current.Equals(GameMode.PlayerOne) || e.Current.Equals(GameMode.PlayerTwo))
        {
            bool draw = false;
            //Check no challenge rule
            if (NoChallengeRule && moveWithoutChallengeCount >= MoveWithoutChallengeLimit)
            {
                draw = true;
                win  = true;
            }
            if (!draw)
            {
                //Check for flag
                for (int i = 0; i < 9; i++)
                {
                    UnitPiece piece = UnitManager.GetUnitPieceForPosition(new BoardPosition(0, i));
                    if (piece.Rank.Equals(UnitRank.Flag) && piece.Owner.Equals(GameManager.PlayerTwo))
                    {
                        flagAtEnd[piece.Owner]++;
                    }

                    piece = UnitManager.GetUnitPieceForPosition(new BoardPosition(7, i));
                    if (piece.Rank.Equals(UnitRank.Flag) && piece.Owner.Equals(GameManager.PlayerOne))
                    {
                        flagAtEnd[piece.Owner]++;
                    }
                }
                foreach (KeyValuePair <PlayerInfo, int> pair in flagAtEnd)
                {
                    if (pair.Value >= 1)
                    {
                        //Meets win condition
                        win    = true;
                        winner = pair.Key;
                    }
                }
            }
        }
    }
示例#6
0
    public void HandleGameModeChange(GameModeChangedEvent e)
    {
        if (!flagAtEnd.ContainsKey(GameManager.PlayerOne))
        {
            flagAtEnd.Add(GameManager.PlayerOne, 0);
        }
        if (!flagAtEnd.ContainsKey(GameManager.PlayerTwo))
        {
            flagAtEnd.Add(GameManager.PlayerTwo, 0);
        }

        if (e.Current.Equals(GameMode.PlayerTransition))
        {
            moveWithoutChallengeCount++;
            moveCount++;
        }
        else if (e.Current.Equals(GameMode.PlayerOne) || e.Current.Equals(GameMode.PlayerTwo))
        {
            bool draw = false;
            //Check no challenge rule
            if (NoChallengeRule && moveWithoutChallengeCount >= MoveWithoutChallengeLimit)
            {
                draw = true;
                win = true;
            }
            if (!draw)
            {
                //Check for flag
                for (int i = 0; i < 9; i++)
                {
                    UnitPiece piece = UnitManager.GetUnitPieceForPosition(new BoardPosition(0, i));
                    if (piece.Rank.Equals(UnitRank.Flag) && piece.Owner.Equals(GameManager.PlayerTwo))
                    {
                        flagAtEnd[piece.Owner]++;
                    }

                    piece = UnitManager.GetUnitPieceForPosition(new BoardPosition(7, i));
                    if (piece.Rank.Equals(UnitRank.Flag) && piece.Owner.Equals(GameManager.PlayerOne))
                    {
                        flagAtEnd[piece.Owner]++;
                    }
                }
                foreach (KeyValuePair<PlayerInfo, int> pair in flagAtEnd)
                {
                    if (pair.Value >= 1)
                    {
                        //Meets win condition
                        win = true;
                        winner = pair.Key;
                    }
                }
            }
        }
    }
示例#7
0
 private void HandleGameModeChanged(GameModeChangedEvent e)
 {
     //Refresh
     if (e.Current.Equals(GameMode.PlayerOneSetup) || e.Current.Equals(GameMode.PlayerTwoSetup))
     {
         int amount = UnitManager.GetPlacementAmountForUnit(rank);
         selected = false;
         if (amount > 0)
         {
             remaining.text = amount.ToString();
             image.color = Color.white;
         }
         else
         {
             image.color = DISABLED_COLOR;
         }
     }
 }
示例#8
0
 private void HandleGameModeChanged(GameModeChangedEvent e)
 {
     //Refresh
     if (e.Current.Equals(GameMode.PlayerOneSetup) || e.Current.Equals(GameMode.PlayerTwoSetup))
     {
         int amount = UnitManager.GetPlacementAmountForUnit(rank);
         selected = false;
         if (amount > 0)
         {
             remaining.text = amount.ToString();
             image.color    = Color.white;
         }
         else
         {
             image.color = DISABLED_COLOR;
         }
     }
 }
示例#9
0
 private void HandleGameModeChanged(GameModeChangedEvent e)
 {
     if (e.Current.Equals(GameMode.PlayerTransition))
     {
         highlightCube.SetActive(false);
         previous = BoardPosition.OFF_BOARD;
         action = false;
         ClearValid();
     }
 }
示例#10
0
 private void HandleGameModeChanged(GameModeChangedEvent e)
 {
     ClearMask();
     if (e.Current.Equals(GameMode.PlayerOneSetup))
     {
         GameManager.PlayerOne.Holder.SetActive(true);
         GameManager.PlayerTwo.Holder.SetActive(false);
     }
     else if (e.Current.Equals(GameMode.PlayerTwoSetup))
     {
         GameManager.PlayerOne.Holder.SetActive(false);
         GameManager.PlayerTwo.Holder.SetActive(true);
     }
     else if (e.Current.Equals(GameMode.PlayerOne))
     {
         MaskPlayer(GameManager.PlayerTwo);
     }
     else if (e.Current.Equals(GameMode.PlayerTwo))
     {
         MaskPlayer(GameManager.PlayerOne);
     }
     else if (e.Current.Equals(GameMode.PlayerTransition))
     {
         GameManager.PlayerOne.Holder.SetActive(true);
         GameManager.PlayerTwo.Holder.SetActive(true);
         ClearMask();
         MaskPlayer(GameManager.PlayerOne);
         MaskPlayer(GameManager.PlayerTwo);
     }
 }