本文整理汇总了C++中MovableObject::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ MovableObject::getName方法的具体用法?C++ MovableObject::getName怎么用?C++ MovableObject::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MovableObject
的用法示例。
在下文中一共展示了MovableObject::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: detachObject
void SceneNode::detachObject( MovableObject & object )
{
auto it = std::find_if( m_objects.begin(), m_objects.end(), [&object]( std::reference_wrapper< MovableObject > obj )
{
return obj.get().getName() == object.getName();
} );
if ( it != m_objects.end() )
{
m_objects.erase( it );
object.attachTo( nullptr );
}
}
示例2:
/** Destructor */
SubObject::~SubObject() {
// Destroy all attached entities and scene nodes
unsigned short count = node_->numAttachedObjects();
for (unsigned short i = 0; i < count; i++) {
MovableObject* obj = node_->getAttachedObject(0U);
node_->detachObject((unsigned short)0);
node_->getCreator()->destroyMovableObject(obj->getName(), obj->getMovableType());
}
node_->getParentSceneNode()->removeAndDestroyChild(node_->getName());
// Remove from world if the subobject was separated off
if (body_.get()) {
body_->setUserPointer(0);
game_->getWorld()->removeCollisionObject(body_.get());
}
}
示例3: check
Object::~Object() {
// Notify projectiles that the object is toast
clearAllTrackers();
//cout << "Collecting " << name_ << endl;
// Un-track
if (target_) target_->removeTracker(this);
// Clean up physics
game_->getWorld()->removeCollisionObject(body_.get());
// Destroy all subobjects
subObjects_.clear();
// Destroy objects attached to the scene node
while (node_->numAttachedObjects() > 0) {
MovableObject* obj = node_->getAttachedObject(0U);
node_->detachObject((unsigned short)0U);
node_->getCreator()->destroyMovableObject(obj->getName(), obj->getMovableType());
}
// Destroy all attached entities and scene nodes
SceneNode::ChildNodeIterator i = node_->getChildIterator();
while (i.hasMoreElements()) {
SceneNode* node = static_cast<SceneNode*>(i.getNext());
MovableObject* obj = node->getAttachedObject(0U);
node->detachObject((unsigned short)0U);
node->getCreator()->destroyMovableObject(obj->getName(), obj->getMovableType());
}
node_->removeAndDestroyAllChildren();
node_->getParentSceneNode()->removeAndDestroyChild(node_->getName());
// Clean up scripting
lua_State* env = game_->getScriptState();
StackCheck check(env);
lua_getref(env, table_);
lua_pushnil(env);
lua_setfield(env, -2, "__thiscpp");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "addEntity");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setEntity");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "addParticleSystem");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setParticleSystem");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "set");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "explode");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "destroy");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "target");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setPosition");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "getPosition");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setVelocity");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "getVelocity");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setOrientation");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "getOrientation");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "createMissile");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "getTarget");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setTarget");
lua_unref(env, table_);
}