本文整理汇总了C++中AnimationPlayer::is_playing方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimationPlayer::is_playing方法的具体用法?C++ AnimationPlayer::is_playing怎么用?C++ AnimationPlayer::is_playing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimationPlayer
的用法示例。
在下文中一共展示了AnimationPlayer::is_playing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: freeze
void AnimController::freeze() {
if (!_freezing) {
_freezing = true;
status_cache.clear();
for (Map<StringName, Node*>::Element *E = anim_nodes.front(); E; E=E->next()) {
AnimationPlayer *player = E->get()->cast_to<AnimationPlayer>();
if (player->is_playing()) {
AnimationStatus status;
status.name = player->get_current_animation();
status.position = player->get_current_animation_pos();
status.player = player;
status_cache.push_back(status);
player->stop(false);
player->set_active(false);
}
}
}
}
示例2: _process_graph
//.........这里部分代码省略.........
}
} break;
case Animation::TYPE_ANIMATION: {
TrackCacheAnimation *t = static_cast<TrackCacheAnimation *>(track);
AnimationPlayer *player = Object::cast_to<AnimationPlayer>(t->object);
if (!player)
continue;
if (delta == 0 || seeked) {
//seek
int idx = a->track_find_key(i, time);
if (idx < 0)
continue;
float pos = a->track_get_key_time(i, idx);
StringName anim_name = a->animation_track_get_key_animation(i, idx);
if (String(anim_name) == "[stop]" || !player->has_animation(anim_name))
continue;
Ref<Animation> anim = player->get_animation(anim_name);
float at_anim_pos;
if (anim->has_loop()) {
at_anim_pos = Math::fposmod(time - pos, anim->get_length()); //seek to loop
} else {
at_anim_pos = MAX(anim->get_length(), time - pos); //seek to end
}
if (player->is_playing() || seeked) {
player->play(anim_name);
player->seek(at_anim_pos);
t->playing = true;
playing_caches.insert(t);
} else {
player->set_assigned_animation(anim_name);
player->seek(at_anim_pos, true);
}
} else {
//find stuff to play
List<int> to_play;
a->track_get_key_indices_in_range(i, time, delta, &to_play);
if (to_play.size()) {
int idx = to_play.back()->get();
StringName anim_name = a->animation_track_get_key_animation(i, idx);
if (String(anim_name) == "[stop]" || !player->has_animation(anim_name)) {
if (playing_caches.has(t)) {
playing_caches.erase(t);
player->stop();
t->playing = false;
}
} else {
player->play(anim_name);
t->playing = true;
playing_caches.insert(t);
}
}
}
} break;