//判断整列是否至少有一个静态刚体
struct IsAllColBody: binary_function<GameElementData, int ,bool>
{
bool operator()( GameElementData &value, int body) const
{
if (value.m_pGameElement != NULL)
{
if (value.m_pGameElement->m_iBodyCate == body)
return true;
}
return false;
}
};
vector<GameElementData>::iterator itIsAllColBody=find_if(StageManager::getInstance()->m_arrvecGameElement[i].begin(),StageManager::getInstance()->m_arrvecGameElement[i].end(),bind2nd(IsAllColBody(),GameElement::BCBlock));
if (itIsAllColBody!=StageManager::getInstance()->m_arrvecGameElement[i].end())//如果整列有静态刚体,则步数清零
{
StageManager::getInstance()->m_arrvecGameElement[i][j].m_iLeftMoveStep = 0;
StageManager::getInstance()->m_arrvecGameElement[i][j].m_iStep = 0;
}
else
{
if(i > 0)//如果整列没有静态刚体,则计算步数
{
StageManager::getInstance()->m_arrvecGameElement[i][j].m_iLeftMoveStep = StageManager::getInstance()->m_arrvecGameElement[i-1][j].m_iStep;
StageManager::getInstance()->m_arrvecGameElement[i][j].m_iStep = StageManager::getInstance()->m_arrvecGameElement[i][j].m_iLeftMoveStep;
}
}