• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetGameObject函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SetGameObject

bool CBattleEvent::Init(IGameObject *pGameObject)
{
	SetGameObject(pGameObject);

	if(!GetGameObject()->BindToNetwork())
		return false;

	if(GetEntity())
		m_entityId = GetEntity()->GetId();

	if(gEnv->bServer && g_pGame->GetGameRules())
	{
		CBattleDust* pBD = g_pGame->GetGameRules()->GetBattleDust();
		if(pBD)
			pBD->NewBattleArea(this);
	}

	return true;
}
开发者ID:kitnet,项目名称:project-o,代码行数:19,代码来源:BattleDust.cpp


示例17: SetViewport

	void Camera::Render() const
	{
		auto context = GraphicsDevice::GetInstance()->GetDeviceContext();
		auto render_buffer= GraphicsDevice::GetInstance()->GetRenderTargetView();
		auto depth_buffer = GraphicsDevice::GetInstance()->GetDepthStencilView();

		SetViewport();

		//set target
		context->OMSetRenderTargets(1, &render_buffer, depth_buffer);

		//clear
		context->ClearRenderTargetView(render_buffer, (const float *) &m_clear_color);
		context->ClearDepthStencilView(depth_buffer, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
		
		//render
		m_current = GetGameObject()->GetComponent<Camera>();
		Renderer::RenderAll();
	}
开发者ID:JCGit,项目名称:Galaxy3D,代码行数:19,代码来源:Camera.cpp


示例18: GetCollider

void Blast::Update(void)
{
	const float LIFE_SPAN = 0.375f;
	static float GREEN = 1.0f;
	
	if( GREEN > 0.5f )
		GREEN = 0.5f;
	else
		GREEN = 1.0f;

	EDGameCore::ICollider* iCollider = GetCollider();
	if( iCollider == 0 )
		return;

	if( iCollider->GetColliderType() != EDGameCore::SPHERE )
		return;

	EDGameCore::SphereCollider* sphereCollider = (EDGameCore::SphereCollider*)iCollider;

	EDMath::Sphere sphere = sphereCollider->GetSphere();

	float deltaTime = EDGameCore::Game::GetDeltaTime();
	age += deltaTime;

	if( age >= LIFE_SPAN )
	{
		EDGameCore::Game::destroy( GetGameObject() );
		return;
	}

	float ratio = age / LIFE_SPAN;

	float ALPHA = 1.0f - ratio*ratio;
	
	sphere.radius *= 1.0f + 10.0f * deltaTime;

	sphereCollider->SetSphere( sphere );

	XMFLOAT4 color( 1.0f, GREEN, 0.0f, ALPHA );

	EDRendererD3D::DebugRenderer::GetInstance()->DrawSphere( sphereCollider->GetWorldSphere(), color );
}
开发者ID:Burnsidious,项目名称:FSGDEngine,代码行数:42,代码来源:Blast.cpp


示例19: GetGameObject

void ComponentRootMotion::OnUpdate(float dt)
{
    float metric_proportion = App->hints->GetFloatValue(ModuleHints::METRIC_PROPORTION);

    GameObject* go   = GetGameObject();

    float angle_diff = atan2(dir.x, dir.z)- atan2(local_dir[dir_axis].x, local_dir[dir_axis].z);
    while(angle_diff < -PI) angle_diff += PI*2.0f;
    while(angle_diff > PI) angle_diff -= PI*2.0f;

    float max_angle  = MAX_ANGULAR_SPEED*dt;
    float angle      = angle_diff > 0.0f ? min(max_angle, angle_diff) : max(-max_angle, angle_diff);

    go->SetLocalRotation((Quat(float3::unitY, angle)*go->GetLocalRotationQ()).Normalized());

    float4x4 transform = go->GetGlobalTransformation();
    float3 global_dir  = transform.TransformDir(local_dir[dir_axis]);

    go->SetLocalPosition(go->GetLocalPosition()+global_dir*(min(MAX_LINEAR_SPEED*metric_proportion, speed)*dt));
}
开发者ID:d0n3val,项目名称:Edu-Game-Engine,代码行数:20,代码来源:ComponentRootMotion.cpp


示例20: GetGameObjectAttribute

bool AnimStateComponent::Update(float fDelta)
{
	if( !m_pkAnimStateAttrib )
	{
		m_pkAnimStateAttrib     = GetGameObjectAttribute(GetGameObject(),AnimStateAttributeBase);
	}

	assert(m_pkAnimStateAttrib);

	IAnimState  *pkAnimState = m_pkAnimStateAttrib->GetAnimState();

	if( pkAnimState!=m_pkCurrState )
		SetAnimState(pkAnimState);

	if (m_pkCurrState)
	{
		m_pkCurrState->Update(m_pkAnimComponent);
	}
	return true;
}
开发者ID:DanielNeander,项目名称:my-3d-engine,代码行数:20,代码来源:AnimationStateComponent.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetGameRules函数代码示例发布时间:2022-05-30
下一篇:
C++ GetGame函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap