本文整理汇总了C++中AnimationPlayer::set_active方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimationPlayer::set_active方法的具体用法?C++ AnimationPlayer::set_active怎么用?C++ AnimationPlayer::set_active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimationPlayer
的用法示例。
在下文中一共展示了AnimationPlayer::set_active方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: _change_node_state
void VisibilityEnabler::_change_node_state(Node *p_node, bool p_enabled) {
ERR_FAIL_COND(!nodes.has(p_node));
{
RigidBody *rb = Object::cast_to<RigidBody>(p_node);
if (rb)
rb->set_sleeping(!p_enabled);
}
{
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
if (ap) {
ap->set_active(p_enabled);
}
}
}
示例3:
void VisibilityEnabler2D::_change_node_state(Node *p_node, bool p_enabled) {
ERR_FAIL_COND(!nodes.has(p_node));
{
RigidBody2D *rb = Object::cast_to<RigidBody2D>(p_node);
if (rb) {
rb->set_sleeping(!p_enabled);
}
}
{
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
if (ap) {
ap->set_active(p_enabled);
}
}
{
AnimatedSprite *as = Object::cast_to<AnimatedSprite>(p_node);
if (as) {
if (p_enabled)
as->play();
else
as->stop();
}
}
{
Particles2D *ps = Object::cast_to<Particles2D>(p_node);
if (ps) {
ps->set_emitting(p_enabled);
}
}
}