当前位置: 首页>>代码示例>>C++>>正文


C++ CEntity类代码示例

本文整理汇总了C++中CEntity的典型用法代码示例。如果您正苦于以下问题:C++ CEntity类的具体用法?C++ CEntity怎么用?C++ CEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: n_assert

int CPhysicsServer::GetEntitiesInShape(PShape Shape, const CFilterSet& ExcludeSet,
									   nArray<PEntity>& Result)
{
	n_assert(CurrLevel);

	Shape->Attach(CurrLevel->GetODEDynamicSpaceID());
	Contacts.Reset();
	Shape->Collide(ExcludeSet, Contacts);
	Shape->Detach();

	int OldResultSize = Result.Size();
	
	//???stamp?
	uint Stamp = GetUniqueStamp();
	for (int i = 0; i < Contacts.Size(); i++)
	{
		CEntity* pEnt = Contacts[i].GetEntity();
		if (pEnt && pEnt->GetStamp() != Stamp)
		{
			pEnt->SetStamp(Stamp);
			Result.Append(pEnt);
		}
	}
	return Result.Size() - OldResultSize;
}
开发者ID:moltenguy1,项目名称:deusexmachina,代码行数:25,代码来源:PhysicsServer.cpp

示例2: saveIdEntity

void IdEntities::saveIdEntity(CHandle entity, int entity_id) {
	if (entity_id >= 0) {
		identified_entities[entity_id] = entity;
		CEntity* e = entity;
		e->setId(entity_id);
	}
}
开发者ID:DopaminaInTheVein,项目名称:ItLightens,代码行数:7,代码来源:entity_parser.cpp

示例3: test_member_archive

void test_member_archive() {
	CEntityQueue entity_queue;
	CEntity &entity = entity_queue.get_head();
	entity.mod_hp(100);
	entity.mod_mp(50);
	CEntity &entity2 = entity_queue.get_end();
	entity2.mod_hp(1000);
	entity2.mod_mp(30);
	CEntity *pentity = entity_queue.get_middle();
	if (pentity) {
		pentity->mod_hp(3576);
		pentity->mod_mp(876);
	}

	std::cout << "head hp is " << entity_queue.get_head().get_hp() << "head mp is " << entity_queue.get_head().get_mp() << std::endl;
	std::cout << "head hp is " << entity_queue.get_end().get_hp() << "head mp is " << entity_queue.get_end().get_mp() << std::endl;
	std::cout << "head hp is " << entity_queue.get_middle()->get_hp() << "head mp is " << entity_queue.get_middle()->get_mp() << std::endl;

	std::stringstream ss;
	boost::archive::binary_oarchive oa(ss);
	oa << entity_queue;

	CEntityQueue entity_queue2;
	boost::archive::binary_iarchive ia(ss);
	ia >> entity_queue2;
	std::cout << "head hp is " << entity_queue2.get_head().get_hp() << "head mp is " << entity_queue2.get_head().get_mp() << std::endl;
	std::cout << "head hp is " << entity_queue2.get_end().get_hp() << "head mp is " << entity_queue2.get_end().get_mp() << std::endl;
	std::cout << "head hp is " << entity_queue.get_middle()->get_hp() << "head mp is " << entity_queue.get_middle()->get_mp() << std::endl;
}
开发者ID:vipnormalhy,项目名称:learn,代码行数:29,代码来源:archive_test.cpp

示例4: moveTo

int moveTo(lua_State *l) {
  LUA_BRIDGE_START;

  LOGV("Lua call: textMessage");

  if (lua_gettop(l) < 2) {
    LOGW("Less argument count for moveTo call");
    return -1;
  }

  const std::string id(lua_tostring(l, 1));
  const Ogre::Vector3 position(Ogre::StringConverter::parseVector3(lua_tostring(l, 2)));

  CEntity *pEntity = CGameStateManager::getSingleton().getChildRecursive(id);
  if (!pEntity) {
    LOGW("Entity '%s' was not found in entity tree.", id.c_str());
    return 0;
  }

  luaHelper::CMoveToWait waiter(pEntity);

  pEntity->moveToTarget(position);


  while (true) {
    LUA_WAIT(50);
    if (waiter.hasReached()) {
      break;
    }
  }

  return 0; // 0 return values
}
开发者ID:ChWick,项目名称:Zelda,代码行数:33,代码来源:UserLuaScriptBridge.cpp

示例5: EditEntity

int CEntitiesDialog::EditEntity( CEntityArray& Entities, int CurrentEntity, CFusionDoc* Doc)
{
	// If more than one entity selected, make sure they're all the same type.
	int nSel = 0;
	CString EntityClassname;
	int i;

	pDoc = Doc;
	mEntityArray = &Entities;

	for (i = 0; i < mEntityArray->GetSize(); ++i)
	{
		CEntity *pEnt;

		pEnt = &Entities[i];
		if (pEnt->IsSelected ())
		{
			if (nSel == 0)
			{
				EntityClassname = pEnt->GetClassname ();
				mCurrentEntity = i;
			}
			else
			{
				if (pEnt->GetClassname () != EntityClassname)
				{
					AfxMessageBox ("To edit multiple entities, they must all be of the same type.");
					return CurrentEntity;
				}
			}
			++nSel;
		}
	}

	MultiEntityFlag = (nSel > 1);
	if (MultiEntityFlag)
	{
	}
	else
	{
		if (CurrentEntity != -1)
		{
			mCurrentEntity = CurrentEntity;
		}
		else
		{
			//	Let's set entity 0 as selected if it exists...
			mCurrentEntity = 0;
			if (mEntityArray->GetSize()  > 0)
			{
				pDoc->ResetAllSelectedEntities();
				pDoc->SelectEntity (&(*mEntityArray)[mCurrentEntity]);
				pDoc->mCurrentEntity = mCurrentEntity;
			}
		}
	}

	DoModal();
	return mCurrentEntity;
}
开发者ID:RealityFactory,项目名称:Genesis3D-Tools,代码行数:60,代码来源:EntitiesDialog.cpp

示例6: switch

	void CGrenadeControllerClient::process(const std::shared_ptr<CMessage>& message) {
		if(!_explotionActive) {
			switch( message->getMessageType() ) {
				case Message::CONTACT_ENTER: {
					std::shared_ptr<CMessageContactEnter> contactMsg = std::static_pointer_cast<CMessageContactEnter>(message);
					Logic::TEntityID idPlayerHit = contactMsg->getEntity();
					CEntity * playerHit = CServer::getSingletonPtr()->getMap()->getEntityByID(idPlayerHit);
					
					_explotionActive=true;
					// Si es el escudo del screamer mandar directamente esos daños a la
					// entidad contra la que hemos golpeado (el escudo), sino, crear explosion
					if(playerHit->getType() == "ScreamerShield") {
						// Crear efecto y sonido de absorcion

						// Eliminamos la entidad en diferido
						CEntityFactory::getSingletonPtr()->deferredDeleteEntity(_entity,false);
					}
					else {
						// Eliminamos la entidad en diferido
						CEntityFactory::getSingletonPtr()->deferredDeleteEntity(_entity,false);
						// Creamos la explosion
						createExplotion();
					}
					break;
				}
				case Message::CONTACT_EXIT: {
						std::cout << "CONTACT EXIT DE LA GRANADA, no deberia entrar nunca" << std::endl;
				}
			}
		}
	} // process
开发者ID:franaisa,项目名称:Gloom,代码行数:31,代码来源:GrenadeControllerClient.cpp

示例7: sq_totimer

CTimer* sq_totimer(SQVM* pVM, int idx)
{
	CEntity* pEntity = sq_toentity(pVM, idx);
	if( pEntity && pEntity->GetType() == ENTITY_TYPE_TIMER )
		return dynamic_cast< CTimer* >( pEntity );
	return NULL;
}
开发者ID:killserver,项目名称:GTA-IV,代码行数:7,代码来源:NativesCommon.cpp

示例8: assert

int CEntityNatives::Create(SQVM* pVM)
{
	CResource* pResource = g_pResourceManager->Get(pVM);
	assert( pResource );

	const char* szName;
	sq_getstring(pVM,2,&szName);

	if(CEntity::GetType(szName) == ENTITY_TYPE_CUSTOM)
	{
		CEntity* pEntity = new CEntity(ENTITY_TYPE_CUSTOM, pResource, szName);
		if(pEntity->GetID() != INVALID_ENTITY_ID_LONG)
		{
			sq_pushentity(pVM,pEntity);
		}
		else
		{
			delete pEntity;
			sq_pushnull(pVM);
		}
	}
	else
		sq_pushnull(pVM);

	return 1;
}
开发者ID:killserver,项目名称:GTA-IV,代码行数:26,代码来源:CEntityNatives.cpp

示例9: process

	void CIARunAway::process(const std::shared_ptr<Logic::IMessage> &message)
	{

		if (message->getType() == "CHANGE_TARGET")
		{
			CEntity* ent = dynamic_cast<CHANGE_TARGET*>(message.get())->getLogicEntity();
			if(ent != NULL)
			{
				if(!ent->getIsDead())
				{
					_target = ent; 
					if (_target->getCenterPosition().x > _entity->getCenterPosition().x)
					{
						_direction = -1;
					}
					else
					{
						_direction = 1;
					}
						
					std::shared_ptr<Logic::TURN> m(new Logic::TURN());
					m->setInt(_direction);
					_entity->emitMessage(m);
				}
			}  

			
		}
	} // process
开发者ID:albmarvil,项目名称:The-Eternal-Sorrow,代码行数:29,代码来源:IARunAway.cpp

示例10: process

void CLifeModifier::process(CMessage *message) {

    CMessageUInt* rxMsg = static_cast<CMessageUInt*>(message);
    CEntity* entity = _entity->getMap()->getEntityByID( rxMsg->getUInt() );

    CMessageUInt *txMsg = new CMessageUInt();

    //LifeModifier manda un mensaje al componente LIFE.cpp
    // mensaje TIPO LIFE_MODIFIER. Action = DAMAGE, HEAL

    txMsg->setType(Message::LIFE_MODIFIER);

    //PT. se carga en el entero el modificador de vida (negativo o positivo)
    //txMsg->setUInt( abs(_LIFE_MODIFIER) );
    txMsg->setUInt(_LIFE_MODIFIER );

    if (_LIFE_MODIFIER < 0)
        txMsg->setAction(Message::DAMAGE);
    else if(_LIFE_MODIFIER > 0)
        txMsg->setAction(Message::HEAL);

    //PT. It just worth sending message when it hurts or heals, when is 0 doesnt worthy
    if(_LIFE_MODIFIER != 0 && _entity!=NULL)
        entity->emitMessage(txMsg, this);

} // process
开发者ID:peplopez,项目名称:El-Rayo-de-Zeus,代码行数:26,代码来源:LifeModifier.cpp

示例11: process

	void CEnemyMeleeAttack::process(const std::shared_ptr<Logic::IMessage> &message)
	{
		if(message->getType() == "CONTROLLER_TOUCHED")
		{
			CEntity* other = dynamic_cast<CONTROLLER_TOUCHED*>(message.get())->getEntidad();

			if(other->getEntityID() == _targetID && _entity->getTag() == "enemy" && canDoDamage())
			{
				ApplyDamage(other);
			}
			
		}

		else if (message->getType() == "CHANGE_TARGET")
		{
			// Si no encuentra la palabra "Minion" en el tipo de entidad, entonces puede canibalizar
			if (_entity->getType().find("Minion") == std::string::npos)
			{
				_target =  dynamic_cast<CHANGE_TARGET*>(message.get())->getLogicEntity(); 

				if (_target)
					_targetID = _target->getEntityID();
			}
		}

	} // process
开发者ID:albmarvil,项目名称:The-Eternal-Sorrow,代码行数:26,代码来源:EnemyMeleeAttack.cpp

示例12: SetHealthEx

//AVO: directly set entity health instead of going throuhg normal health property which operates on delta
void CScriptGameObject::SetHealthEx(float hp)
{
    CEntity *obj = smart_cast<CEntity*>(&object());
    if (!obj) return;
    clamp(hp, -0.01f, 1.0f);
    obj->SetfHealth(hp);
}
开发者ID:denanden,项目名称:xray-16,代码行数:8,代码来源:script_game_object4.cpp

示例13: StartATM

void CBank::StartATM()
{
  double time1, sim_time = executive->SimulationTime();
  CDistribution dist;
  CEntity * client;

  if(atm_free){
      if(!atm_queue->EhVazia()){

          // Get call from queue
          client = (CEntity *) atm_queue->ObterInfo();
          atm_queue->Remover();
          client->SetActivity(STARTATM);

          // Collect stats on call waiting
          client_wait.Add(time - client->start);
          atm_wait.Add(time - client->start);
          client->start = time;

          if(_DEBUG_) printf("ATM Starts %f \n", time);

          // Calculate call ending time
          time1 = sim_time + dist.NormalLimited(atm_service_mean, atm_service_stddev, min_service, max_service);

          // Schedule end of conversation time
          executive->AddActivity(time1, ENDATM, client);

          // atm isn't free
          atm_free = false;
      }
  }
}
开发者ID:efqdalton,项目名称:cci_37_lab_01,代码行数:32,代码来源:ActivityApproach.cpp

示例14: Lock

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CUICreateChar::Reset()
{	
	Lock(FALSE);
	m_iSelectedJob	= 0;	
	m_fZDelta		= 0.0f;
	m_fRotDelta		= 0.0f;

	m_ebCharName.ResetString();

	// 카메라 설정, 캐릭터 위치 설정.	
	for(int i = 0; i < MAXJOB; ++i)
	{
		const int iMarker			= _aiMarkerEntities[i];
		CEntity *penMarker			= m_pWorld->EntityFromID(iMarker);	
		penMarker->SetSkaModel(JobInfo().GetFileName(i));
		g_CharacterAngle[i] = penMarker->GetPlacement().pl_OrientationAngle(1);
		
		CModelInstance* pMI	= penMarker->GetModelInstance();
		if(pMI)
		{		
			INDEX idAttackIdle = ska_GetIDFromStringTable( JobInfo().GetAnimationName( i, ANIM_IDLE ) );
			pMI->AddAnimation(idAttackIdle, AN_LOOPING|AN_NORESTART|AN_CLEAR, 1, 0);
		}
	}
	
#if defined(G_BRAZIL) 
		CharWearing();
#endif
	ChangeSelJob();

	m_bIsShowMessageInfo = _pGameState->IsCreatableNightShadow();
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:35,代码来源:UICreateChar.cpp

示例15: Reset

void CGameWorld::Tick()
{
	if(m_ResetRequested)
		Reset();

	if(!m_Paused)
	{
		if(GameServer()->m_pController->IsForceBalanced())
			GameServer()->SendChat(-1, CGameContext::CHAT_ALL, "Teams have been balanced");
		// update all objects
		for(int i = 0; i < NUM_ENTTYPES; i++)
			for(CEntity *pEnt = m_apFirstEntityTypes[i]; pEnt; )
			{
				m_pNextTraverseEntity = pEnt->m_pNextTypeEntity;
				pEnt->Tick();
				pEnt = m_pNextTraverseEntity;
			}
		
		for(int i = 0; i < NUM_ENTTYPES; i++)
			for(CEntity *pEnt = m_apFirstEntityTypes[i]; pEnt; )
			{
				m_pNextTraverseEntity = pEnt->m_pNextTypeEntity;
				pEnt->TickDefered();
				pEnt = m_pNextTraverseEntity;
			}
	}

	RemoveEntities();
}
开发者ID:EliteKuchen,项目名称:AiP-DDRace,代码行数:29,代码来源:gameworld.cpp


注:本文中的CEntity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。