1.子节点可以通过this->getParent()来获得相应的父节点,并且进行强制类型转换。

((Scene*)this->getParent())->getPhysicsWorld()->setAutoStep(false);

2.父节点可以通过this->getChildren()来获得全部的子节点,还可以用for (auto &child : vec)进行批量操作,对所有子节点进行按顺序进行操作。

auto vec = this->getChildren();
for (auto &child : vec)
{
  if (child->getTag() != PAUSE_MENU)
  child->onEnter();
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
相关资源
相似解决方案