本文整理汇总了C++中Costume::update方法的典型用法代码示例。如果您正苦于以下问题:C++ Costume::update方法的具体用法?C++ Costume::update怎么用?C++ Costume::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Costume
的用法示例。
在下文中一共展示了Costume::update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void Actor::update(uint frameTime) {
// Snap actor to walkboxes if following them. This might be
// necessary for example after activating/deactivating
// walkboxes, etc.
if (_constrain && !_walking) {
g_grim->getCurrSet()->findClosestSector(_pos, NULL, &_pos);
}
if (_turning) {
float turnAmt = g_grim->getPerSecond(_turnRate) * 5.f;
Math::Angle dyaw = _moveYaw - _yaw;
dyaw.normalize(-180);
// If the actor won't turn because the rate is set to zero then
// have the actor turn all the way to the destination yaw.
// Without this some actors will lock the interface on changing
// scenes, this affects the Bone Wagon in particular.
if (turnAmt == 0 || turnAmt >= fabsf(dyaw.getDegrees())) {
setYaw(_moveYaw);
_turning = false;
} else if (dyaw > 0) {
setYaw(_yaw + turnAmt);
} else {
setYaw(_yaw - turnAmt);
}
_currTurnDir = (dyaw > 0 ? 1 : -1);
}
if (_walking) {
updateWalk();
}
if (_walkChore.isValid()) {
if (_walkedCur) {
if (!_walkChore.isPlaying()) {
_walkChore.playLooping(true);
}
if (_restChore.isPlaying()) {
_restChore.stop(true);
}
} else {
if (_walkedLast && _walkChore.isPlaying()) {
_walkChore.stop(true);
if (!_restChore.isPlaying()) {
_restChore.playLooping(true);
}
}
}
}
if (_leftTurnChore.isValid()) {
if (_walkedCur || _walkedLast)
_currTurnDir = 0;
if (_restChore.isValid()) {
if (_currTurnDir != 0) {
if (getTurnChore(_currTurnDir)->isPlaying() && _restChore.isPlaying()) {
_restChore.stop(true, 500);
}
} else if (_lastTurnDir != 0) {
if (!_walkedCur && getTurnChore(_lastTurnDir)->isPlaying()) {
_restChore.playLooping(true);
}
}
}
if (_lastTurnDir != 0 && _lastTurnDir != _currTurnDir) {
getTurnChore(_lastTurnDir)->stop(true);
}
if (_currTurnDir != 0 && _currTurnDir != _lastTurnDir) {
getTurnChore(_currTurnDir)->playLooping(true, 500);
}
} else {
_currTurnDir = 0;
}
// The rest chore might have been stopped because of a
// StopActorChore(nil). Restart it if so.
if (!_walkedCur && _currTurnDir == 0 && !_restChore.isPlaying()) {
_restChore.playLooping(true);
}
_walkedLast = _walkedCur;
_walkedCur = false;
_lastTurnDir = _currTurnDir;
_currTurnDir = 0;
// Update lip syncing
if (_lipSync) {
int posSound;
// While getPosIn60HzTicks will return "-1" to indicate that the
// sound is no longer playing, it is more appropriate to check first
if (g_grim->getSpeechMode() != GrimEngine::TextOnly && g_sound->getSoundStatus(_talkSoundName.c_str()))
posSound = g_sound->getPosIn60HzTicks(_talkSoundName.c_str());
else
posSound = -1;
if (posSound != -1) {
int anim = _lipSync->getAnim(posSound);
if (_talkAnim != anim) {
if (anim != -1) {
//.........这里部分代码省略.........