コード例 #1
0
 /// <summary>
 /// Sets the Current selected piece only if it belongs to the current players turn. Also Displays any
 /// info about  the current piece. CuurentPiece will be used to determine if charater can roll.
 ///
 /// </summary>
 /// <param name="piece">Piece to display info about when selected</param>
 /// <returns>Character piece if can roll, else null</returns>
 private void DetermineSelecetion(CharacterPiece piece)
 {
     //Debug.Log("Selected Piece " + piece + " Turn Phase: " + _turn.TurnPhase);
     if (_turnStarted)
     {
         // Hnadle differently not sure how yet......
         if (_turn.TurnPhase == Phase.Attack)
         {
             // piece is attackable
             if (_Attack.SelectPieceToAttack(piece))
             {
                 if (_Attack.PieceToAttack != null)
                 {
                     _Attack.PieceToAttack.DisplaySelected(false);
                 }
                 piece.DisplaySelected(true); // highlight selecteced piece
             }
         }
     }
     if (piece)
     {
         SetCurrentPiece(piece); // select piece
     }
     else
     {
         _currentPiece = null;
     }
 }
コード例 #2
0
 /// <summary>
 /// Sets the Current selected piece only if it belongs to the current players turn. Also Displays any
 /// info about  the current piece. CuurentPiece will be used to determine if charater can roll.
 ///
 /// </summary>
 /// <param name="piece">Piece to display info about when selected</param>
 /// <returns>Character piece if can roll, else null</returns>
 private void SetCurrentPiece(CharacterPiece piece)
 {
     if (_currentPiece != null && _currentPiece != Turn.Piece)
     {
         _currentPiece.DisplaySelected(false);
     }
     _DontRollButton.gameObject.SetActive(false);
     _DontRollButton.enabled = false;
     _RollButton.gameObject.SetActive(false);
     _RollButton.enabled = false;
     // Means the piece belongs to the current sides turn
     if (CurrentSide == piece.Stat.Side)
     {
         // Piece belongs to Current Player
         if (CurrentPlayer != null && CurrentPlayer.Pieces != null && CurrentPlayer.Pieces.Contains(piece))
         {
             if (piece.canMove && !_turnStarted) // piece can still roll.
             {
                 _RollButton.gameObject.SetActive(true);
                 _RollButton.enabled = true;
                 _DontRollButton.gameObject.SetActive(true);
                 _DontRollButton.enabled = true;
                 piece.DisplaySelected(true);
                 _currentPiece = piece;
             }
         }
     }
     _currentPiece = piece;
 }
コード例 #3
0
 /// <summary>
 /// This handles the end of the attack phase turn by reseting variables.
 /// </summary>
 private void EndAttack()
 {
     Debug.Log("Ending Attack");
     GameManager.instance.CanSelectePiece = true;
     GameManager.instance.CurrentPiece    = _PieceAttacking;
     BtnAttackUI.SetActive(false);  // turn off attack button
     AttackDiceUI.SetActive(false); // turn off dice
     AttackablePieces.Clear();
     if (PieceToAttack != null)
     {
         PieceToAttack.DisplaySelected(false); // unselected the attack piece
     }
     _PieceAttacking = null;
     PieceToAttack   = null;
     _DoneAttackRoll = false;
     _AttackDiceList.Clear();
     _AttackAmount     = 0;
     _AppliedAttack    = false;
     _attackDiceModify = 0;
     _doneAttack       = true;
 }