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


C++ GetGameObject函数代码示例

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


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

示例1: switch

WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, uint64 guid)
{
    switch (GUID_HIPART(guid))
    {
        case HIGHGUID_PLAYER:        return GetPlayer(p, guid);
        case HIGHGUID_TRANSPORT:
        case HIGHGUID_MO_TRANSPORT:
        case HIGHGUID_GAMEOBJECT:    return GetGameObject(p, guid);
        case HIGHGUID_VEHICLE:
        case HIGHGUID_UNIT:          return GetCreature(p, guid);
        case HIGHGUID_PET:           return GetPet(p, guid);
        case HIGHGUID_DYNAMICOBJECT: return GetDynamicObject(p, guid);
        case HIGHGUID_CORPSE:        return GetCorpse(p, guid);
        default:                     return NULL;
    }
}
开发者ID:Neecro,项目名称:SkyFireEMU_rebase,代码行数:16,代码来源:ObjectAccessor.cpp

示例2: switch

WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, ObjectGuid const& guid)
{
    switch (guid.GetHigh())
    {
        case HighGuid::Player:        return GetPlayer(p, guid);
        case HighGuid::Transport:
        case HighGuid::GameObject:    return GetGameObject(p, guid);
        case HighGuid::Vehicle:
        case HighGuid::Creature:          return GetCreature(p, guid);
        case HighGuid::Pet:           return GetPet(p, guid);
        case HighGuid::DynamicObject: return GetDynamicObject(p, guid);
        case HighGuid::AreaTrigger:   return GetAreaTrigger(p, guid);
        case HighGuid::Corpse:        return GetCorpse(p, guid);
        default:                     return NULL;
    }
}
开发者ID:dantewow,项目名称:TrinityCore,代码行数:16,代码来源:ObjectAccessor.cpp

示例3: sprintf

//------------------------------------------------------------------------
void CItem::InitClient(int channelId)
{
	const int numAccessories = m_accessories.size();
	
	// send the differences between the current, and the initial setup
	for (int i = 0; i < numAccessories; i++)
	{
		uint16 classId = 0;
		bool result = g_pGame->GetIGameFramework()->GetNetworkSafeClassId(classId, m_accessories[i].pClass->GetName());

#if !defined(_RELEASE)
		if(!result)
		{
			char errorMsg[256];
			sprintf(errorMsg, "CItem::InitClient failed to find network safe class id for %s", m_accessories[i].pClass->GetName());
			CRY_ASSERT_MESSAGE(result, errorMsg);
		}
#endif
		if(result)
			GetGameObject()->InvokeRMI(ClAttachInitialAccessory(), AccessoryParams(classId), eRMI_ToClientChannel, channelId);
	}

	IActor *pOwner=GetOwnerActor();
	if (!pOwner)
		return;

	// only send the pickup message if the player is connecting
	// for items spawned during gameplay, CItem::PickUp is already sending the pickup message
	INetChannel *pNetChannel=m_pGameFramework->GetNetChannel(channelId);
	if (pNetChannel && pNetChannel->GetContextViewState()<eCVS_InGame)
	{
		if (!m_stats.mounted && !m_stats.used)
		{
			pOwner->GetGameObject()->InvokeRMIWithDependentObject(CActor::ClPickUp(), 
				CActor::PickItemParams(GetEntityId(), m_stats.selected, false), eRMI_ToClientChannel, GetEntityId(), channelId);
			//GetOwnerActor()->GetGameObject()->InvokeRMI(CActor::ClPickUp(), 
			//	CActor::PickItemParams(GetEntityId(), m_stats.selected, false), eRMI_ToClientChannel, channelId);
		}
	}

	if (m_stats.mounted && m_stats.used)
	{
		pOwner->GetGameObject()->InvokeRMIWithDependentObject(CActor::ClStartUse(), 
			CActor::ItemIdParam(GetEntityId()), eRMI_ToClientChannel, GetEntityId(), channelId);
	}
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:47,代码来源:ItemClientServer.cpp

示例4: GetOwnerActor

void CHeavyMountedWeapon::TryRipOffGun()
{
	CActor *pActor = GetOwnerActor();
	if(!pActor)
		return;

	PerformRipOff(pActor);
	
	if(gEnv->bServer)
	{
		CHANGED_NETWORK_STATE(this, ASPECT_RIPOFF);
	}
	else
	{
		GetGameObject()->InvokeRMI(SvRequestRipOff(), EmptyParams(), eRMI_ToServer);
	}
}
开发者ID:Xydrel,项目名称:Infected,代码行数:17,代码来源:HeavyMountedWeapon.cpp

示例5: GetGameObject

ObjectData* Event::GetGameObject(const std::string& aName, ObjectData* aParent) const
{
    for (unsigned int i = 0; i < aParent->myChilds.Size(); ++i)
    {
        if (aParent->myChilds[i]->myName == aName)
        {
            return aParent->myChilds[i];
        }

        ObjectData* data = GetGameObject(aName, aParent->myChilds[i]);
        if (data != nullptr)
        {
            return data;
        }
    }
    return nullptr;
}
开发者ID:PekaOchKlickaGrupp7,项目名称:PekaOchKlicka,代码行数:17,代码来源:Event.cpp

示例6: FullSerialize

void CGunTurret::FullSerialize(TSerialize ser)
{
	CWeapon::FullSerialize(ser);

	ser.BeginGroup("GunTurret");
	ser.Value("target", m_targetId);
	ser.EndGroup();

	if(ser.IsReading())
	{
		if(!IsDestroyed())
		{
			if(IGameObject *pGameObject = GetGameObject())
				PostInit(pGameObject);
		}
	}
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:17,代码来源:GunTurret.cpp

示例7: GetGameObject

//-----------------------------------------------------------------------
void CWeapon::RequestCancelReload()
{
    CActor *pActor=GetOwnerActor();

    if (!gEnv->bServer && pActor && pActor->IsClient())
    {
        if(m_fm)
        {
            m_fm->CancelReload();
        }
        GetGameObject()->InvokeRMI(SvRequestCancelReload(), DefaultParams(), eRMI_ToServer);
    }
    else if (IsServer())
    {
        SvCancelReload();
    }
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:18,代码来源:WeaponClientServer.cpp

示例8: GetGameObject

	GameObject* Transform::Find(RegistrationId nameHash)
	{
		GameObject* gameObject = GetGameObject();
		if( gameObject->GetNameHash() == nameHash )
			return gameObject;

		for(Transform* child = firstChild; child != 0; child = child->nextSibling)
		{
			GameObject* childObject = child->GetGameObject();
			RegistrationId childNameHash = childObject->GetNameHash();

			if( childNameHash == nameHash )
				return childObject;
		}

		return 0;		
	}
开发者ID:Burnsidious,项目名称:FSGDEngine,代码行数:17,代码来源:Transform.cpp

示例9: GetGameObject

void CAccessory::Physicalize( bool enable, bool rigid )
{
    const bool isMounted = (GetParentId() != 0);

    int profile = eIPhys_NotPhysicalized;
    if (enable && !isMounted)
        {
            profile = rigid ? eIPhys_PhysicalizedRigid : eIPhys_PhysicalizedStatic;
        }

    if (IsServer())
        {
            GetGameObject()->SetAspectProfile(eEA_Physics, profile);
        }

    m_deferPhysicalization = eIPhys_Max;
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:17,代码来源:Accessory.cpp

示例10: GetGameObject

const EDMath::Aabb& ShapeRenderer::GetAabb(void)
{
	const EDMath::Float4x4& worldMat = GetGameObject()->GetTransform()->GetWorldMatrix();

	if(renderShapePtr != 0)
	{
		EDMath::Aabb aabb = renderShapePtr->GetRenderMesh()->GetAabb();
		EDMath::TransformAabb(worldAabb, aabb, worldMat);
	}
	else
	{
		worldAabb.center = worldMat.WAxis;
		worldAabb.extents.x = worldAabb.extents.y = worldAabb.extents.z = 0.001f;
	}

	return worldAabb;
}
开发者ID:Burnsidious,项目名称:FSGDEngine,代码行数:17,代码来源:ShapeRenderer.cpp

示例11: GetTransform

void Target::Update(void)
{
	if( spinTimer > 0.0f )
	{
		float deltaTime = EDGameCore::Game::GetDeltaTime();

		spinTimer -= deltaTime;

		GetTransform()->RotateLocalY( 3.14159f * deltaTime );
	}
	else
	{
		LookAt* lookAtBehavior = GetGameObject()->GetBehavior<LookAt>();
		if( lookAtBehavior != 0 )
			lookAtBehavior->enable();
	}
}
开发者ID:Burnsidious,项目名称:FSGDEngine,代码行数:17,代码来源:Target.cpp

示例12: EndBattle

void BattlefieldWG::ProcessEvent(WorldObject* obj, uint32 eventId)
{
    if (!obj || !IsWarTime())
        return;

    // We handle only gameobjects here
    GameObject* go = obj->ToGameObject();
    if (!go)
        return;

    // On click on titan relic
    if (go->GetEntry() == GO_WINTERGRASP_TITAN_S_RELIC)
    {
        if (CanInteractWithRelic())
            EndBattle(false);
        else if (GameObject* relic = GetRelic())
            relic->SetRespawnTime(RESPAWN_IMMEDIATELY);
    }

    // if destroy or damage event, search the wall/tower and update worldstate/send warning message
    for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
    {
        if (GameObject* build = GetGameObject((*itr)->m_BuildGUID))
        {
            if (go->GetEntry() == build->GetEntry())
            {
                if (build->GetGOInfo()->building.damagedEvent == eventId)
                    (*itr)->Damaged();

                if (build->GetGOInfo()->building.destroyedEvent == eventId)
                    (*itr)->Destroyed();

                // Add Support of Quests Toppling the Towers & Southern Sabotage
                if (go->GetEntry()==190356 || go->GetEntry()==190357 || go->GetEntry()==190358)
                {
                    for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
                        if (Player* player = sObjectAccessor->FindPlayer(*itr))
                            player->RewardPlayerAndGroupAtEvent(35074, go);
                }

                break;
            }
        }
    }
}
开发者ID:WarlordCore,项目名称:TrinityCore-SymboCore,代码行数:45,代码来源:BattlefieldWG.cpp

示例13: ResetCharacterModel

void CLivingEntitySample::Reset( const bool enteringGameMode )
{
	ResetCharacterModel();
	ResetAnimationState();
	Physicalize();

	IGameObject* pGameObject = GetGameObject();
	if ( enteringGameMode )
	{
		pGameObject->EnablePostUpdates( this );
		pGameObject->EnablePrePhysicsUpdate( ePPU_Always );
	}
	else
	{
		pGameObject->DisablePostUpdates( this );
		pGameObject->EnablePrePhysicsUpdate( ePPU_Never );
	}
}
开发者ID:AiYong,项目名称:CryGame,代码行数:18,代码来源:LivingEntitySample.cpp

示例14: FUNCTION_PROFILER

//------------------------------------------------------------------------
void CGameRules::ClientHit(const HitInfo &hitInfo)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	IActor *pClientActor = g_pGame->GetIGameFramework()->GetClientActor();
	IEntity *pTarget = m_pEntitySystem->GetEntity(hitInfo.targetId);
	IEntity *pShooter =	m_pEntitySystem->GetEntity(hitInfo.shooterId);
	IVehicle *pVehicle = g_pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(hitInfo.targetId);
	IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(hitInfo.targetId);
	bool dead = pActor?(pActor->GetHealth()<=0):false;

	if((pClientActor && pClientActor->GetEntity()==pShooter) && pTarget && (pVehicle || pActor) && !dead)
	{
		SAFE_HUD_FUNC(GetCrosshair()->CrosshairHit());
		SAFE_HUD_FUNC(GetTagNames()->AddEnemyTagName(pActor?pActor->GetEntityId():pVehicle->GetEntityId()));
	}

	if(pActor == pClientActor)
		if (gEnv->pInput) gEnv->pInput->ForceFeedbackEvent( SFFOutputEvent(eDI_XI, eFF_Rumble_Basic, 0.5f * hitInfo.damage * 0.01f, hitInfo.damage * 0.02f, 0.0f));

/*	if (gEnv->pAISystem && !gEnv->bMultiplayer)
	{
		static int htMelee = GetHitTypeId("melee");
		if (pShooter && hitInfo.type != htMelee)
		{
			ISurfaceType *pSurfaceType = GetHitMaterial(hitInfo.material);
			const ISurfaceType::SSurfaceTypeAIParams* pParams = pSurfaceType ? pSurfaceType->GetAIParams() : 0;
			const float radius = pParams ? pParams->fImpactRadius : 5.0f;
			gEnv->pAISystem->BulletHitEvent(hitInfo.pos, radius, pShooter->GetAI());
		}
	}*/

	CreateScriptHitInfo(m_scriptHitInfo, hitInfo);
	CallScript(m_clientStateScript, "OnHit", m_scriptHitInfo);

	bool backface = hitInfo.dir.Dot(hitInfo.normal)>0;
	if (!hitInfo.remote && hitInfo.targetId && !backface)
	{
		if (!gEnv->bServer)
			GetGameObject()->InvokeRMI(SvRequestHit(), hitInfo, eRMI_ToServer);
		else
			ServerHit(hitInfo);
	}
}
开发者ID:RenEvo,项目名称:dead6,代码行数:45,代码来源:GameRulesClientServer.cpp

示例15: GetGameObject

void MeshRenderer::Update(GameTime* gameTime,GraphicsDevice* graphicsDevice)
{
	int drawCalls = 0;
	int triangles = 0;
	if(_mesh != NULL)
	{
		VertexBuffer* vertexBuffer = _mesh->GetVertexBuffer();
		IndexBuffer* indexBuffer = _mesh->GetIndexBuffer();
		
		//Set the per object uniforms of the game object(for example - the world matrix)
		_material->SetObjectUniforms(graphicsDevice, GetGameObject());

		vertexBuffer->BindBuffer();
		//Draw the mesh
		unsigned int numberOfAttributeInformations = vertexBuffer->GetNumberOfAttributeInfos();
		for(unsigned int i = 0; i < numberOfAttributeInformations; i++)
		{
			const VertexAttributeInformation& thisInfo = vertexBuffer->GetVertexAttributeInformation(i);
			graphicsDevice->EnableVertexAttribute(thisInfo.GetIndex());
			graphicsDevice->SetVertexAttribute(thisInfo.GetIndex(), 
							  thisInfo.GetSize(), 
							  thisInfo.GetType(),
							  thisInfo.GetIsNormalized(), 
							  thisInfo.GetStride(), 
							  thisInfo.GetOffset());
		}

		//Bind the index buffer
		indexBuffer->BindBuffer();
		//DRAW
		graphicsDevice->DrawElements(GraphicsPrimitiveType::Triangles(), indexBuffer->GetNumberOfElements(), indexBuffer->GetIndexDataType(), (void*)0);
		drawCalls++;
		triangles += indexBuffer->GetNumberOfElements() / 3;

		for(unsigned int i = 0; i < numberOfAttributeInformations; i++)
		{
			graphicsDevice->DisableVertexAttribute(vertexBuffer->GetVertexAttributeInformation(i).GetIndex());
		}
		indexBuffer->UnbindBuffer();
		vertexBuffer->UnbindBuffer();
	}
	SetNumberOfDrawCalls(drawCalls);
	SetNumberOfTriangles(triangles);
}
开发者ID:NiklasBorglund,项目名称:OGLPlayground,代码行数:44,代码来源:MeshRenderer.cpp


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