コード例 #1
0
ファイル: GameController.cs プロジェクト: psema4/janus
    // This method is used to display an example piece where the player is looking
    // so they know what to expect when they press the Fire button.
    public void StartedLookingAtPosition(BoardPosition position)
    {
        if (m_state != GameState.OnlineMatchMyTurn && m_state != GameState.PracticingMyTurn)
        {
            return;
        }

        GamePiece newPiece = null;

        if ((m_selectedPiece == m_pieceA || m_selectedPiece == m_pieceB) &&
            m_board.CanPlayerMoveToPostion(position.x, position.y))
        {
            newPiece = m_board.AddProposedPiece(m_selectedPiece.Prefab, position);
        }
        else if (m_selectedPiece == m_powerPiece &&
                 m_board.CanPlayerPowerUpPosition(position.x, position.y))
        {
            newPiece = m_board.AddProposedPowerPiece(m_selectedPiece.Prefab, position);
        }

        if (newPiece != null)
        {
            if (m_proposedPiece != null)
            {
                DestroyObject(m_proposedPiece.gameObject);
            }
            m_proposedPiece = newPiece;
        }
    }