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


C++ CGameObject类代码示例

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


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

示例1: StopTalk

void CUITalkWnd::Update()
{
	//остановить разговор, если нужно
	if (g_actor && m_pActor && !m_pActor->IsTalking() )
	{
		StopTalk();
	}else{
		CGameObject* pOurGO = smart_cast<CGameObject*>(m_pOurInvOwner);
		CGameObject* pOtherGO = smart_cast<CGameObject*>(m_pOthersInvOwner);
	
		if(	NULL==pOurGO || NULL==pOtherGO )
			Game().StartStopMenu(this,true);
	}

	if(m_bNeedToUpdateQuestions)
	{
		UpdateQuestions			();
	}
	inherited::Update			();
	UpdateCameraDirection		(smart_cast<CGameObject*>(m_pOthersInvOwner));

	UITalkDialogWnd->UpdateButtonsLayout(b_disable_break, m_pOthersInvOwner->IsTradeEnabled());

	if(playing_sound())
	{
		CGameObject* pOtherGO	= smart_cast<CGameObject*>(m_pOthersInvOwner);
		Fvector P				= pOtherGO->Position();
		P.y						+= 1.8f;
		m_sound.set_position	(P);
	}
}
开发者ID:Charsi82,项目名称:xray-1.5.10-2015-,代码行数:31,代码来源:UITalkWnd.cpp

示例2: getIView

bool CHistoryManager::doModify(	SAction* action, bool redo )
{
	IDoc *pDoc = getIView()->getDocument();

	CSerializable *pObject = &action->object1;
	if ( redo )
		pObject = &action->object2;

	pObject->setCursorRecord(0);

	// get object id
	SSerializableRec *pObjectID	= pObject->getProperty("objectID");

	if ( pObjectID == NULL )
		return false;

	long objID = -1;
	sscanf( pObjectID->data, "%ld", &objID );	

	CGameObject* pObj =	pDoc->searchObject( objID );
	if ( pObj == NULL )
		return false;

	pObj->updateData( pObject );

	return true;
}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:27,代码来源:CHistoryManager.cpp

示例3: switch

void CInventoryBox::OnEvent(NET_Packet& P, u16 type)
{
	inherited::OnEvent	(P, type);

	switch (type)
	{
	case GE_OWNERSHIP_TAKE:
		{
			u16 id;
            P.r_u16(id);
			CObject* itm = Level().Objects.net_Find(id);  VERIFY(itm);
			m_items.push_back	(id);
			itm->H_SetParent	(this);
			itm->setVisible		(FALSE);
			itm->setEnabled		(FALSE);
		}break;
	case GE_OWNERSHIP_REJECT:
		{
			u16 id;
            P.r_u16(id);
			CObject* itm = Level().Objects.net_Find(id);  VERIFY(itm);
			xr_vector<u16>::iterator it;
			it = std::find(m_items.begin(),m_items.end(),id); VERIFY(it!=m_items.end());
			m_items.erase		(it);
			itm->H_SetParent	(NULL,!P.r_eof() && P.r_u8());

			if( m_in_use )
			{
				CGameObject* GO		= smart_cast<CGameObject*>(itm);
				Actor()->callback(GameObject::eInvBoxItemTake)( this->lua_game_object(), GO->lua_game_object() );
			}
		}break;
	};
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:34,代码来源:InventoryBox.cpp

示例4: Affect

void CRadioactiveZone::Affect(SZoneObjectInfo* O) 
{
	// вермя срабатывания не чаще, чем заданный период
	if(m_dwDeltaTime < m_dwPeriod) return;
//.	m_dwDeltaTime = 0;
	
	CGameObject *GO = O->object;
	
	if(GO) 
	{
		Fvector pos; 
		XFORM().transform_tiny(pos,CFORM()->getSphere().P);

#ifdef DEBUG		
		char pow[255]; 
		sprintf(pow, "zone hit. %.3f", Power(GO->Position().distance_to(pos)));
		if(bDebug) Msg("%s %s", *GO->cName(), pow);
#endif

		Fvector dir; 
		dir.set(0,0,0);
	
		Fvector position_in_bone_space;
		float power = (GameID() == GAME_SINGLE) ? Power(GO->Position().distance_to(pos)) : 0.0f;
		float impulse = 0.f;
		if(power > EPS) 
		{
//.			m_dwDeltaTime = 0;
			position_in_bone_space.set(0.f,0.f,0.f);

			CreateHit(GO->ID(),ID(),dir,power,BI_NONE,position_in_bone_space,impulse,ALife::eHitTypeRadiation);
		}
	}
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:34,代码来源:RadioactiveZone.cpp

示例5:

void CPurchaseList::process	(const CGameObject &owner, const shared_str &name, const u32 &count, const float &probability)
{
	VERIFY3					(count,"Invalid count for section in the purchase list",*name);
	VERIFY3					(!fis_zero(probability,EPS_S),"Invalid probability for section in the purchase list",*name);

	const Fvector			&position = owner.Position();
	const u32				&level_vertex_id = owner.ai_location().level_vertex_id();
	const ALife::_OBJECT_ID	&id = owner.ID();
	CRandom					random((u32)(CPU::QPC() & u32(-1)));
	u32 j = 0;
	for (u32 i=0; i<count; ++i) {
		if (random.randF() > probability)
			continue;

		++j;
		Level().spawn_item		(*name,position,level_vertex_id,id,false);
	}

	DEFICITS::const_iterator	I = m_deficits.find(name);
	VERIFY3						(I == m_deficits.end(),"Duplicate section in the purchase list",*name);
	m_deficits.insert			(
		std::make_pair(
			name,
			(float)count*probability
			/
			_max((float)j,min_deficit_factor)
		)
	);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:29,代码来源:purchase_list.cpp

示例6: GetPrototypeXML

	CGameObject* CFactory::InstantiatePrototype(const string &AProtoName, const string &AName /*= ""*/)
	{
		CXMLNode *xml = GetPrototypeXML(AProtoName);
		if (!xml)
		{
			Log("ERROR", "Can't create prototype instance: no such prototype: '%s'", AProtoName.c_str());
			return NULL;
		}

		CGameObject *result = New<CGameObject>(AName);

		if (AName.empty())
			result->SetName(AProtoName + itos(result->GetID()));

		result->Prototype = true;
		result->Deserialize(xml);

		SetRecursionLimit(AProtoName, from_string<int>(xml->SafeGetAttribute("RecursionLimit", "-1")));

		TraversePrototypeNode(xml, result, result);

		result->FinalizeCreation();

		Log("INFO", "Prototype INSTANTIATED: '%s', instance name: '%s'", AProtoName.c_str(), result->GetName().c_str());

		return result;
	}
开发者ID:rotanov,项目名称:deku2d-engine,代码行数:27,代码来源:2de_Factory.cpp

示例7: getDraggingObject

bool CNoseHolder::FrameMsg(CFrameMsg *msg) {
	if (!_dragObject) {
		CGameObject *dragObj = getDraggingObject();
		if (!dragObj)
			return false;

		if (!dragObj->isEquals("Feathers") || getView() != findView())
			return false;

		_dragObject = dragObj;
	}

	if (_dragObject) {
		if (!checkPoint(Point(_dragObject->_bounds.left,
				_dragObject->_bounds.top))) {
			_field11C = false;
		} else if (!_field11C) {
			CActMsg actMsg("Sneeze");
			actMsg.execute(this);
			_field11C = true;
		}
	}

	return true;
}
开发者ID:86400,项目名称:scummvm,代码行数:25,代码来源:nose_holder.cpp

示例8:

CGameObject *CInputHandler::dragEnd(const Point &pt, CTreeItem *dragItem) {
	CViewItem *view = _gameManager->getView();
	if (!view)
		return nullptr;

	// Scan through the view items to find the item being dropped on
	CGameObject *target = nullptr;
	for (CTreeItem *treeItem = view->scan(view); treeItem; treeItem = treeItem->scan(view)) {
		CGameObject *gameObject = dynamic_cast<CGameObject *>(treeItem);
		if (gameObject && gameObject != dragItem) {
			if (gameObject->checkPoint(pt))
				target = gameObject;
		}
	}

	if (target) {
		// Check if the cursor is on the PET. If so, pass to the PET
		// to see what specific element the drag ended on
		CProjectItem *project = view->getRoot();
		if (project) {
			CPetControl *petControl = project->getPetControl();
			if (petControl && petControl->contains(pt)) {
				target = petControl->dragEnd(pt);
				if (!target)
					target = petControl;
			}
		}
	}

	return target;
}
开发者ID:a-detiste,项目名称:scummvm,代码行数:31,代码来源:input_handler.cpp

示例9: OnCollision

void CSniper::OnCollision(float deltaTime, std::vector<CGameObject*>* listObjectCollision)
{
	float normalX = 0;
	float normalY = 0;
	float moveX = 0.0f;
	float moveY = 0.0f;
	float timeCollision;

	for (std::vector<CBullet*>::iterator it = CPoolingObject::GetInstance()->m_listBulletOfObject.begin(); it != CPoolingObject::GetInstance()->m_listBulletOfObject.end();)
	{
		CGameObject* obj = *it;
		timeCollision = CCollision::GetInstance()->Collision(obj, this, normalX, normalY, moveX, moveY, deltaTime);
		if((timeCollision > 0.0f && timeCollision < 1.0f) || timeCollision == 2.0f)
		{
			if(obj->IsAlive() && obj->GetLayer() == LAYER::PLAYER)
			{
				// Gan trang thai die cho doi tuong
				this->m_stateCurrent = SN_IS_DIE;
				// Xoa vien dan ra khoi d.s
				it = CPoolingObject::GetInstance()->m_listBulletOfObject.erase(it);
				//Load sound die
				ManageAudio::GetInstance()->playSound(TypeAudio::ENEMY_DEAD_SFX);
				// Tang diem cua contra len
				CContra::GetInstance()->IncreateScore(500);
			}
			else
				++it;
 		}
		else
		{
			++it;
		}
	}
}
开发者ID:doanhtdpl,项目名称:game-con-tra,代码行数:34,代码来源:CSniper.cpp

示例10: getDraggingObject

bool CLemonDispensor::FrameMsg(CFrameMsg *msg) {
	if (_v2 || !_isSummer)
		return true;

	if (!_draggingObject) {
		CGameObject *obj = getDraggingObject();
		if (obj && getView() == findView()) {
			if (obj->isEquals("Perch")) {
				petDisplayMessage(1, TOO_SHORT_TO_REACH_BRANCHES);
				return true;
			}

			if (obj->isEquals("LongStick"))
				_draggingObject = obj;
		}
	}

	if (_draggingObject) {
		Point pt(_origPt.x + _draggingObject->_bounds.left,
			_origPt.y + _draggingObject->_bounds.top);
		bool flag = checkPoint(pt, true);

		if (_fieldEC == 0) {
			if (flag && ++_v3 > 10) {
				CLemonFallsFromTreeMsg lemonMsg(pt);
				lemonMsg.execute("Lemon");
				_v2 = 1;
			}
		} else if (_fieldEC == 1 && !flag) {
			_fieldEC = 0;
		}
	}

	return true;
}
开发者ID:OmerMor,项目名称:scummvm,代码行数:35,代码来源:lemon_dispensor.cpp

示例11: Msg

void game_cl_CaptureTheArtefact::OnBuyMenu_Ok()
{
#ifdef DEBUG
	Msg("* CTA: Buy menu OK...");
#endif // #ifdef DEBUG
	typedef CUIGameCTA::BuyMenuItemsCollection TBuyCol;

	VERIFY2(m_game_ui, "game ui not initialized");
	CUIGameCTA::BuyMenuItemsCollection toBuyItemsCollection;
	s32 moneyDif = 0;
	m_game_ui->GetPurchaseItems(toBuyItemsCollection, moneyDif);
	R_ASSERT(local_player);
	if (local_player->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD))
	{
		if (InWarmUp())
		{
			buy_amount =  0;
		} else 
		{
			buy_amount = moneyDif;
		}
		UpdateMoneyIndicator();
	}
	
	
	CGameObject* pPlayer = smart_cast<CGameObject*>(Level().CurrentEntity());
	VERIFY(pPlayer);
	
	NET_Packet P;
	pPlayer->u_EventGen(P, GE_GAME_EVENT, pPlayer->ID());
	P.w_u16(GAME_EVENT_PLAYER_BUY_FINISHED);
	if (InWarmUp())
	{
		P.w_s32(0);
	} else
	{
		P.w_s32(moneyDif);
	}
	P.w_u16(static_cast<u16>(toBuyItemsCollection.size()));

	TBuyCol::const_iterator bie = toBuyItemsCollection.end();
	
	for (TBuyCol::const_iterator toBuyIter = toBuyItemsCollection.begin();
		toBuyIter != bie; ++toBuyIter)
	{
		P.w_u8(toBuyIter->first);
		P.w_u8(toBuyIter->second);
	}

	pPlayer->u_EventSend(P);
	
	if (local_player->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD))
	{
		u_EventGen(P, GE_GAME_EVENT, local_player->GameID);
		P.w_u16(GAME_EVENT_PLAYER_BUYMENU_CLOSE);
		u_EventSend(P);
	}
	set_buy_menu_not_ready();
}
开发者ID:2asoft,项目名称:xray,代码行数:59,代码来源:game_cl_capturetheartefact_buywnd.cpp

示例12: getObject

void CPetGfxElement::draw(CScreenManager *screenManager, const Common::Point &destPos) {
	CGameObject *obj = getObject();
	if (!obj)
		obj = _object0;

	if (obj)
		obj->draw(screenManager, destPos);
}
开发者ID:86400,项目名称:scummvm,代码行数:8,代码来源:pet_gfx_element.cpp

示例13:

CScriptGameObject *get_object_by_id(u16 id)
{
	CGameObject* pGameObject = smart_cast<CGameObject*>(Level().Objects.net_Find(id));
	if(!pGameObject)
		return NULL;

	return pGameObject->lua_game_object();
}
开发者ID:Charsi82,项目名称:xray-1.5.10-2015-,代码行数:8,代码来源:level_script.cpp

示例14: OnStep

	EContextEstablishTaskResult OnStep( SContextEstablishState& state )
	{
		bool allowPlayers = (m_what & eFS_Players) != 0;
		bool allowGameRules = (m_what & eFS_GameRules) != 0;
		bool allowOthers = (m_what & eFS_Others) != 0;
		EntityId gameRulesId = 0;
		if (IEntity * pGameRules = CCryAction::GetCryAction()->GetIGameRulesSystem()->GetCurrentGameRulesEntity())
			gameRulesId = pGameRules->GetId();

		// we are in the editor, and that means that there have been entities spawned already
		// that are not bound to the network context... so lets bind them!
		IEntityItPtr pIt = gEnv->pEntitySystem->GetEntityIterator();
		while (IEntity * pEntity = pIt->Next())
		{
			bool isOther = true;

			bool isPlayer = false;
			IActor* pActor = CCryAction::GetCryAction()->GetIActorSystem()->GetActor(pEntity->GetId());
			if (pActor && pActor->IsPlayer())
			{
				isPlayer = true;
				isOther = false;
			}
			if (isPlayer && !allowPlayers)
				continue;

			bool isGameRules = false;
			if (pEntity->GetId() == gameRulesId)
			{
				isGameRules = true;
				isOther = false;
			}
			if (isGameRules && !allowGameRules)
				continue;

			if (isOther && !allowOthers)
				continue;

			CGameObject * pGO = (CGameObject *) pEntity->GetProxy( ENTITY_PROXY_USER );
			if (pGO)
			{
				if (pGO->IsBoundToNetwork())
					pGO->BindToNetwork(eBTNM_Force); // force rebinding
			}

			SEntitySpawnParams fakeParams;
			fakeParams.id = pEntity->GetId();
			fakeParams.nFlags = pEntity->GetFlags();
			fakeParams.pClass = pEntity->GetClass();
			fakeParams.qRotation = pEntity->GetRotation();
			fakeParams.sName = pEntity->GetName();
			fakeParams.vPosition = pEntity->GetPos();
			fakeParams.vScale = pEntity->GetScale();
			CCryAction::GetCryAction()->GetGameContext()->OnSpawn( pEntity, fakeParams );
		}
		return eCETR_Ok;
	}
开发者ID:aronarts,项目名称:FireNET,代码行数:57,代码来源:CET_EntitySystem.cpp

示例15: getIView

void CAddObjectController::cancelController()
{
	IView *pView = getIView();
	wchar_t *currentTemplate = pView->getCurrentObjectTemplate();
	
	CGameObject *p = CObjTemplateFactory::getGameObject( currentTemplate );
	if ( p )
		p->setVisible( false );
}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:9,代码来源:CAddObjectController.cpp


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