当前位置: 首页>>代码示例>>C++>>正文


C++ PlayerManager::takeBalance方法代码示例

本文整理汇总了C++中PlayerManager::takeBalance方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerManager::takeBalance方法的具体用法?C++ PlayerManager::takeBalance怎么用?C++ PlayerManager::takeBalance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerManager的用法示例。


在下文中一共展示了PlayerManager::takeBalance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: action

//-----------------------------------------------------------------------------
void CardReceiveMoneyFromPlayers::action(
        PlayerManager &i_players
        )
{
	//Uses method in PlayerManager 
    i_players.takeBalance(i_players.getMoneyFromEachPlayer(m_balanceToAdd));
}
开发者ID:cblop,项目名称:monopoly,代码行数:8,代码来源:CardReceiveMoneyFromPlayers.cpp

示例2: payRent

void NormalProperty::payRent(
        PlayerManager &i_players
        )
{
    if(i_players.takeBalance(m_rentPrices[m_numOfHouse]))
    {
        i_players.addBalance(m_rentPrices[m_numOfHouse],m_owner);
        std::cout << "Rent paid: " << m_rentPrices[m_numOfHouse] << std::endl;
    }
    else
    {
        std::cout << "Player does not have enough money to pay\n";
    }
}
开发者ID:cblop,项目名称:monopoly,代码行数:14,代码来源:NormalProperty.cpp

示例3: payRent

//-------------------------------------------------------------------------
void Station::payRent(
        PlayerManager & i_players
        )
{
    unsigned int rent = m_rentPrices[0];
    std::cout << "You have to pay " << rent << " for Rent\n";
    if(i_players.takeBalance(rent))
    {
        i_players.addBalance(rent,m_owner);
    }
    else
    {
        std::cout << "Player do not have enough money to pay";
        rent = i_players.withdrawGame();
        i_players.addBalance(rent);
    }
}
开发者ID:cblop,项目名称:monopoly,代码行数:18,代码来源:Station.cpp

示例4: payRent

//-----------------------------------------------------------------------------
void Utility::payRent(
        PlayerManager & i_players
        )
{
    Dice dice;
    dice.roll();
    const unsigned int amountTobePaid = dice.getTotal() *m_rentPrices[0];
    if(i_players.takeBalance(amountTobePaid))
    {
        std::cout << "You have paid " << amountTobePaid << " rent.\n";
        i_players.addBalance(amountTobePaid,m_owner);
    }
    else
    {
        std::cout << "You do not have enough money to pay!\n";
        i_players.withdrawGame();
    }
}
开发者ID:cblop,项目名称:monopoly,代码行数:19,代码来源:Utility.cpp


注:本文中的PlayerManager::takeBalance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。