本文整理汇总了C++中Door::setTransferDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ Door::setTransferDirection方法的具体用法?C++ Door::setTransferDirection怎么用?C++ Door::setTransferDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Door
的用法示例。
在下文中一共展示了Door::setTransferDirection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addDoor
void ItemFactory::addDoor(eID doorID, eDirection dir, cocos2d::Vec2 pos, std::string model)
{
if (doorID != eID_Door1 && doorID != eID_Door2)
return;
if (dir == eDir_None || (pos.x < 0 || pos.x >= MAPWIDTH || pos.y < 0 || pos.y >= MAPHEIGHT))
return;
// remove origin door
removeDoor(doorID);
Door** ppDoorToAdd = nullptr;
if (doorID == eID_Door1)
ppDoorToAdd = &m_pDoors.first;
else if (doorID == eID_Door2)
ppDoorToAdd = &m_pDoors.second;
if (ppDoorToAdd)
{
Door* pDoorToAdd = Door::create(model);
*ppDoorToAdd = pDoorToAdd;
this->addChild(pDoorToAdd, 1, doorID);
pDoorToAdd->setPosition(VisibleRect::getVisibleRect().origin + VisibleRect::getHalfGridVec() + VisibleRect::getGridLength()*pos);
pDoorToAdd->setIndex(pos);
//set the door transfer direction
pDoorToAdd->setTransferDirection(dir);
//actual door direction is opposite to transfer direction
pDoorToAdd->setRotation(arcByDirection(oppositeDirection(dir)));
//set the grid type
m_pSnakeMap->setGridType(pos, eType_Door);
}
//connect the two doors
if (m_pDoors.first)
m_pDoors.first->setOtherDoor(m_pDoors.second);
if (m_pDoors.second)
m_pDoors.second->setOtherDoor(m_pDoors.first);
}