本文整理汇总了C++中Paddle::setDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ Paddle::setDirection方法的具体用法?C++ Paddle::setDirection怎么用?C++ Paddle::setDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paddle
的用法示例。
在下文中一共展示了Paddle::setDirection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateLeftPlayer
void WorldManager::updateLeftPlayer(PaddleMove direction) {
Paddle *leftPlayer = mWorld->getLeftPlayer();
if (direction == MOVE_DOWN && !isLeftPlayerHitBottomWall()) {
leftPlayer->setDirection(PADDLE_DIRECTION_DOWN);
} else if (direction == MOVE_UP && !isLeftPlayerHitTopWall()) {
leftPlayer->setDirection(PADDLE_DIRECTION_UP);
} else {
leftPlayer->stop();
}
}
示例2: updateRightPlayer
void WorldManager::updateRightPlayer(PaddleMove direction) {
Paddle *rightPlayer = mWorld->getRightPlayer();
if (direction == MOVE_DOWN && !isRightPlayerHitBottomWall()) {
rightPlayer->setDirection(Ogre::Vector3(0, -1, 0));
} else if (direction == MOVE_UP && !isRightPlayerHitTopWall()) {
rightPlayer->setDirection(Ogre::Vector3(0, 1, 0));
} else {
rightPlayer->stop();
}
}
示例3: calculateNextMoveSimple
void AIManager::calculateNextMoveSimple() {
Paddle* leftPlayer = mWorld->getLeftPlayer();
Wall* bottomWall = mWorld->getBottomWall();
Wall* topWall = mWorld->getTopWall();
if (leftPlayer->hitVerticallyWith(bottomWall)) {
leftPlayer->setDirection(PADDLE_DIRECTION_UP);
}
if (leftPlayer->hitVerticallyWith(topWall)) {
leftPlayer->setDirection(PADDLE_DIRECTION_DOWN);
}
if (leftPlayer->getDirection() == PADDLE_DIRECTION_DOWN) {
mNextMove = MOVE_DOWN;
} else {
mNextMove = MOVE_UP;
}
}