void BasicScene::myAddChild(Sprite* s, const int type) { if (s == nullptr) return; // 根据类型将指针添加到CollisionController中 if (type == TYPE_ACTOR) { Actor* ac = static_cast<Actor*> (s); ac->setTag(1); cc.addActor(ac); } else if (type == TYPE_HAT) { Hat* h = static_cast<Hat*> (s); h->setTag(0); cc.addHat(h); } else if (type == TYPE_FAN) { Fan* fan = dynamic_cast<Fan*> (s); fan->setTag(max_fan_tag++); } // 将实例添加到Layer中 this->addChild(s); }