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


C++ GetEntity函数代码示例

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


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

示例1: GetEntity

void CAnimatedCharacter::SetBlendWeightParam(const EMotionParamID motionParamID, const float value, const uint8 targetFlags/* = eBWPT_All*/)
{
	if (motionParamID >= eMotionParamID_BlendWeight && motionParamID <= eMotionParamID_BlendWeight_Last)
	{ //only allowed on the generic blend weights params

		IEntity* pEntity = GetEntity();
		CRY_ASSERT(pEntity);

		if (targetFlags & eBWPT_FirstPersonSkeleton)
		{
			if (ICharacterInstance* pCharacterInstance = pEntity->GetCharacter(0))
			{
				if (ISkeletonAnim* pSkeletonAnim = pCharacterInstance->GetISkeletonAnim())
				{
					pSkeletonAnim->SetDesiredMotionParam(motionParamID, value, 0.0f);
				}
			}
		}

		if (targetFlags & eBWPT_ShadowSkeleton)
		{
			if (m_hasShadowCharacter)
			{
				if (ICharacterInstance* pShadowCharacter = pEntity->GetCharacter(m_shadowCharacterSlot))
				{
					if (ISkeletonAnim* pShadowSkeletonAnim = pShadowCharacter->GetISkeletonAnim())
					{
						pShadowSkeletonAnim->SetDesiredMotionParam(motionParamID, value, 0.0f);
					}
				}
			}
		}

	} 
	else
	{
		CryLogAlways("[CryAnimation] ERROR: motionParam that was sent: %d is not within allowed range of blendweights %d to %d", motionParamID, eMotionParamID_BlendWeight, eMotionParamID_BlendWeight_Last);
	}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:39,代码来源:AnimatedCharacterPPS_ParamCalculation.cpp

示例2: RequireUpdate

void CHeavyMountedWeapon::Update( SEntityUpdateContext& ctx, int slot )
{
	BaseClass::Update(ctx, slot);
	
	if (m_rotatingSoundID!=INVALID_SOUNDID)
	{
		if (m_RotationSoundTimeOut>0)
		{
			m_RotationSoundTimeOut -= ctx.fFrameTime;
			RequireUpdate( eIUS_General );
		}
		else
		{
			StopSound(m_rotatingSoundID);
			m_rotatingSoundID = INVALID_SOUNDID;
		}
	}

	// Helper for editor placing
	if (gEnv->IsEditing())
	{
		// If host id is not 0, it means it is mounted to a vehicle, so don't render the helper in that case
		if (!GetHostId())
		{
			IRenderAuxGeom* pRenderAux = gEnv->pRenderer->GetIRenderAuxGeom();

			const Matrix34& weaponTM = GetEntity()->GetWorldTM();
			const Vec3 point1 = weaponTM.GetTranslation();
			const Vec3 point2 = point1 - (m_sharedparams->pMountParams->ground_distance * weaponTM.GetColumn2());
			const Vec3 point3 = point2 - (m_sharedparams->pMountParams->body_distance * weaponTM.GetColumn1());

			pRenderAux->DrawLine(point1, ColorB(0, 192, 0), point2, ColorB(0, 192, 0), 3.0f);
			pRenderAux->DrawLine(point2, ColorB(0, 192, 0), point3, ColorB(0, 192, 0), 3.0f);
			pRenderAux->DrawSphere(point3, 0.15f, ColorB(192, 0, 0));

			RequireUpdate(eIUS_General);
		}
	}
}
开发者ID:Xydrel,项目名称:Infected,代码行数:39,代码来源:HeavyMountedWeapon.cpp

示例3: rot

//-----------------------------------------------------------------------
void CVehiclePartLight::UpdateLight(const float frameTime)
{ 
  if (m_slot == -1)
    return;

	// move to vehicle event change view?
  if (m_diffuseMult[0] != m_diffuseMult[1])
  {
    SEntitySlotInfo info;
    if (m_pVehicle->GetEntity()->GetSlotInfo(m_slot, info) && info.pLight)
    {
      CDLight& light = info.pLight->GetLightProperties();    

      IActor* pActor = CCryAction::GetCryAction()->GetClientActor();
      bool localPlayer = (pActor != NULL) && (pActor->GetLinkedVehicle() == m_pVehicle);

			IVehicleSeat* pSeat = pActor ? m_pVehicle->GetSeatForPassenger(pActor->GetEntityId()) : NULL;
			IVehicleView* pView = pSeat? pSeat->GetView(pSeat->GetCurrentView()) : NULL;
			bool isThirdPersonView = pView? pView->IsThirdPerson() : true;
      if (localPlayer && !isThirdPersonView)
				light.SetLightColor(ColorF(m_diffuseCol * m_diffuseMult[0], 1.f));
      else
				light.SetLightColor(ColorF(m_diffuseCol * m_diffuseMult[1], 1.f));    
    }
  }  

  if (m_pHelper)
  { 
    const static Matrix33 rot(Matrix33::CreateRotationXYZ(Ang3(0.f, 0.f, DEG2RAD(90.f))));
    
    Matrix34 helperTM;
		m_pHelper->GetVehicleTM(helperTM);
    Matrix34 localTM = Matrix33(helperTM) * rot;
    localTM.SetTranslation(helperTM.GetTranslation());

    GetEntity()->SetSlotLocalTM(m_slot, localTM);  
  }

}
开发者ID:aronarts,项目名称:FireNET,代码行数:40,代码来源:VehiclePartLight.cpp

示例4: DrawSlot

//----------------------------------------------------
void CRocketLauncher::ActivateTPLaser(bool activate)
{
	if(activate)
	{
		DrawSlot( eIGS_Aux1,true);
		ActivateLaserDot(true,false);
		m_laserTPOn = true;
		
		//Force first update
		m_lastUpdate = 0.0f;
		m_smoothLaserLength = -1.0f;
		UpdateTPLaser(0.0f);
		RequireUpdate(eIUS_General);
	}
	else
	{
		DrawSlot( eIGS_Aux1,false);
		GetEntity()->SetSlotLocalTM( eIGS_Aux1,Matrix34::CreateIdentity());
		ActivateLaserDot(false,false);
		m_laserTPOn = false;
	}
}
开发者ID:nhnam,项目名称:Seasons,代码行数:23,代码来源:RocketLauncher.cpp

示例5: GetEntity

//------------------------------------------
bool CC4Projectile::Init(IGameObject *pGameObject)
{
	bool ok = CProjectile::Init(pGameObject);

	// C4 should always be saved (unlike other projectiles)
	IEntity* pEntity = GetEntity();
	pEntity->SetFlags(pEntity->GetFlags() & ~ENTITY_FLAG_NO_SAVE);

	if(!gEnv->bServer)
	{
		CreateLight();
	}

	if(gEnv->bMultiplayer)
	{
		CGameRules *pGameRules = g_pGame->GetGameRules();
		pGameRules->RegisterTeamChangedListener(this);
		pGameRules->RegisterClientConnectionListener(this);
	}

	return ok;
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:23,代码来源:C4Projectile.cpp

示例6: GetEntity

void CMonoEntityExtension::FullSerialize(TSerialize ser)
{
	IEntity *pEntity = GetEntity();

	ser.BeginGroup("Properties");
	auto pPropertyHandler = static_cast<CEntityPropertyHandler *>(pEntity->GetClass()->GetPropertyHandler());
	for(int i = 0; i < pPropertyHandler->GetPropertyCount(); i++)
	{
		if(ser.IsWriting())
		{
			IEntityPropertyHandler::SPropertyInfo propertyInfo;
			pPropertyHandler->GetPropertyInfo(i, propertyInfo);

			ser.Value(propertyInfo.name, pPropertyHandler->GetProperty(pEntity, i));
		}
		else
		{
			IEntityPropertyHandler::SPropertyInfo propertyInfo;
			pPropertyHandler->GetPropertyInfo(i, propertyInfo);

			char *propertyValue = nullptr;
			ser.ValueChar(propertyInfo.name, propertyValue, 0);

			pPropertyHandler->SetProperty(pEntity, i, propertyValue);
		}
	}

	ser.EndGroup();

	ser.BeginGroup("ManagedEntity");

	IMonoArray *pArgs = CreateMonoArray(1);
	pArgs->InsertNativePointer(&ser);

	m_pScript->GetClass()->InvokeArray(m_pScript->GetManagedObject(), "InternalFullSerialize", pArgs);
	pArgs->Release();

	ser.EndGroup();
}
开发者ID:nathanpapke,项目名称:CryMono,代码行数:39,代码来源:MonoEntity.cpp

示例7: GetMovementController

void CFlyer::SetActorMovement(SMovementRequestParams& movementRequestParams)
{
	SMovementState state;
	GetMovementController()->GetMovementState(state);

	if (movementRequestParams.vMoveDir.IsZero())
	{
		Vec3 vDesiredDirection = movementRequestParams.vLookTargetPos.IsZero()
			? GetEntity()->GetWorldRotation() * FORWARD_DIRECTION
			: (movementRequestParams.vLookTargetPos - state.eyePosition).GetNormalizedSafe();
		SetDesiredDirection(vDesiredDirection);
		SetDesiredVelocity(Vec3Constants<float>::fVec3_Zero);
	}
	else
	{
		Vec3 vDesiredDirection = movementRequestParams.vLookTargetPos.IsZero()
			? movementRequestParams.vMoveDir.GetNormalizedSafe()
			: (movementRequestParams.vLookTargetPos - state.eyePosition).GetNormalizedSafe();
		SetDesiredDirection(vDesiredDirection);
		SetDesiredVelocity(movementRequestParams.vMoveDir * movementRequestParams.fDesiredSpeed);
	}
}
开发者ID:Adi0927,项目名称:alecmercer-origins,代码行数:22,代码来源:Flyer.cpp

示例8: switch

void CBoundingContainer::ProcessEvent( SEntityEvent& entityEvent )
{
	switch(entityEvent.event)
	{
	case ENTITY_EVENT_RESET:
		{
			const bool bEnteringGameMode = ( entityEvent.nParam[ 0 ] == 1 );
			Reset( bEnteringGameMode );
		}
		break;
	case ENTITY_EVENT_START_LEVEL: // Need to wait till all entities are loaded since other entities can be inside
		{
			bool bHideContainedItemsOnStart = false;
			EntityScripts::GetEntityProperty(GetEntity(), "bHideContainedItemsOnStart", bHideContainedItemsOnStart);
			if (bHideContainedItemsOnStart && !gEnv->IsEditor())
			{
				HideContainedItems();
			}
		}
		break;
	}
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:22,代码来源:BoundingContainer.cpp

示例9: Unused

RodinBTNode::ETickStatus RodinBTNodePlayActions::Tick(float DeltaTime) {
  Unused(DeltaTime);

  WBEntity* const pEntity = GetEntity();

  WBEvent BTNodePlayActionsEvent;
  STATIC_HASHED_STRING(BTNodePlayActionsEvent);
  BTNodePlayActionsEvent.SetEventName(sBTNodePlayActionsEvent);
  pEntity->AddContextToEvent(BTNodePlayActionsEvent);

  const uint NumActions = m_Actions.Size();
  for (uint ActionIndex = 0; ActionIndex < NumActions; ++ActionIndex) {
    WBAction* const pAction = m_Actions[ActionIndex];
    ASSERT(pAction);

    WBActionStack::Push(BTNodePlayActionsEvent);
    pAction->Execute();
    WBActionStack::Pop();
  }

  return ETS_Success;
}
开发者ID:ptitSeb,项目名称:Eldritch,代码行数:22,代码来源:rodinbtnodeplayactions.cpp

示例10: GetEntity

void CComponentVida::Decrease(float _fAmount)
{
  if(m_fVida > 0.0f)
  {
    m_fTimeSinceHit = 0.0f;

    if(_fAmount < 0.0f)
      _fAmount *= -1;

    m_fVida -= _fAmount;

    if(m_fVida <= 0.f)
    {
      m_fVida = 0.0f;
      SEvent l_morir;
      l_morir.Msg = SEvent::MORIR;
      l_morir.Receiver = l_morir.Sender = GetEntity()->GetGUID();
      
      CORE->GetEntityManager()->SendEvent(l_morir);
    }
  }
}
开发者ID:Atridas,项目名称:biogame,代码行数:22,代码来源:ComponentVida.cpp

示例11: MakeVectors

bool Bot::IsFriendInLineOfFire (float distance)
{
   // bot can't hurt teammates, if friendly fire is not enabled...
   if (!engine->IsFriendlyFireOn ())
      return false;

   MakeVectors (pev->v_angle);

   TraceResult tr;
   TraceLine (EyePosition (), EyePosition () + pev->v_angle.Normalize () * distance, false, false, GetEntity (), &tr);

   // check if we hit something
   if (!FNullEnt (tr.pHit))
   {
      int playerIndex = ENTINDEX (tr.pHit) - 1;

      // check valid range
      if (playerIndex >= 0 && playerIndex < engine->GetMaxClients () && g_clients[playerIndex].team == GetTeam (GetEntity ()) && (g_clients[playerIndex].flags & CFLAG_ALIVE))
         return true;
   }

   // search the world for players
   for (int i = 0; i < engine->GetMaxClients (); i++)
   {
      if (!(g_clients[i].flags & CFLAG_USED) || !(g_clients[i].flags & CFLAG_ALIVE) || g_clients[i].team != GetTeam (GetEntity ()) || g_clients[i].ent == GetEntity ())
         continue;

      edict_t *ent = g_clients[i].ent;

      float friendDistance = (GetEntityOrigin (ent) - pev->origin).GetLength ();
      float squareDistance = sqrtf (1089.0f + (friendDistance * friendDistance));

      if ((GetShootingConeDeviation (GetEntity (), &GetEntityOrigin (ent))) > 
		  ((friendDistance * friendDistance) / (squareDistance * squareDistance)) && 
		  friendDistance <= distance)
         return true;
   }
   return false;
}
开发者ID:CCNHsK-Dev,项目名称:SyPB,代码行数:39,代码来源:combat.cpp

示例12: IsGroupOfEnemies

bool Bot::IsGroupOfEnemies (Vector location, int numEnemies, int radius)
{
   int numPlayers = 0;

   // search the world for enemy players...
   for (int i = 0; i < engine->GetMaxClients (); i++)
   {
      if (!(g_clients[i].flags & CFLAG_USED) || !(g_clients[i].flags & CFLAG_ALIVE) || g_clients[i].ent == GetEntity ())
         continue;

      if ((GetEntityOrigin (g_clients[i].ent) - location).GetLength () < radius)
      {
         // don't target our teammates...
         if (g_clients[i].team == GetTeam (GetEntity ()))
            return false;

         if (numPlayers++ > numEnemies)
            return true;
      }
   }
   return false;
}
开发者ID:CCNHsK-Dev,项目名称:SyPB,代码行数:22,代码来源:combat.cpp

示例13: if

//------------------------------------------------------------------------
void CVehiclePartEntity::UpdateEntity()
{
	if(IEntity *pEntity = GetPartEntity())
	{
		Matrix34	worldTM;

		if(m_pHelper)
		{
			m_pHelper->GetWorldTM(worldTM);
		}
		else if(IVehiclePart *pParent = GetParent())
		{
			worldTM	= pParent->GetWorldTM();
		}
		else
		{
			worldTM	= GetEntity()->GetWorldTM();
		}

		pEntity->SetWorldTM(worldTM);
	}
}
开发者ID:aronarts,项目名称:FireNET,代码行数:23,代码来源:VehiclePartEntity.cpp

示例14: VPROF_BUDGET

//================================================================================
// Update hitbox positions and visibility
// This function can be very expensive, it should only be called for the active enemy.
//================================================================================
void CEntityMemory::UpdateHitboxAndVisibility()
{
	VPROF_BUDGET("CEntityMemory::UpdateHitboxAndVisibility", VPROF_BUDGETGROUP_BOTS_EXPENSIVE);

	// For now let's assume that we do not know Hitbox and therefore we have no vision
	UpdateVisibility(false);

	m_Hitbox.Reset();
	m_VisibleHitbox.Reset();

	// We obtain the positions of the Hitbox
	Utils::GetHitboxPositions(GetEntity(), m_Hitbox);

	if (!m_Hitbox.IsValid())
		return;

	{
		VPROF_BUDGET("UpdateVisibility", VPROF_BUDGETGROUP_BOTS_EXPENSIVE);

		// Now let's check if we can see any of them
		if (m_pBot->GetDecision()->IsAbleToSee(m_Hitbox.head)) {
			m_VisibleHitbox.head = m_Hitbox.head;
			UpdateVisibility(true);
		}

		if (m_pBot->GetDecision()->IsAbleToSee(m_Hitbox.chest)) {
			m_VisibleHitbox.chest = m_Hitbox.chest;
			UpdateVisibility(true);
		}

		if (m_pBot->GetDecision()->IsAbleToSee(m_Hitbox.feet)) {
			m_VisibleHitbox.feet = m_Hitbox.feet;
			UpdateVisibility(true);
		}
	}

	// We update the ideal position
	GetVisibleHitboxPosition(m_vecIdealPosition, m_pBot->GetProfile()->GetFavoriteHitbox());
}
开发者ID:WootsMX,项目名称:InSource,代码行数:43,代码来源:bot_utils.cpp

示例15: GetEntity

void CBoundingContainer::HideContainedItems()
{
	IEntity* pEntity = GetEntity();
	if (pEntity)
	{
		// Proximity query all entities in area
		AABB aabbBounds(m_vBoundingMin, m_vBoundingMax);

		OBB	obbBounds;
		Matrix34	worldTM = pEntity->GetWorldTM();
		obbBounds.SetOBBfromAABB(Matrix33(worldTM), aabbBounds);
		aabbBounds.Reset();
		aabbBounds.SetAABBfromOBB(pEntity->GetWorldPos(), obbBounds);

		SEntityProximityQuery query;
		query.box = aabbBounds;
		gEnv->pEntitySystem->QueryProximity(query);
		const int iQueryCount = query.nCount;
		for (int i = 0; i < iQueryCount; ++i)
		{
			IEntity* pQueryEntity = query.pEntities[i];
			if (pQueryEntity)
			{
				const EntityId queryEntityId = pQueryEntity->GetId();
				
				if (!stl::find(m_hiddenEntities, queryEntityId)) // Only if not already hidden
				{
					// Make sure entity type should be hidden and entity pos is also inside, not just an intersection
					if (ShouldHide(queryEntityId, pQueryEntity) && aabbBounds.IsContainPoint(pQueryEntity->GetWorldPos()))
					{
						pQueryEntity->Hide(true);
						m_hiddenEntities.push_back(pQueryEntity->GetId());
					}
				}
			}
		}
	}
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:38,代码来源:BoundingContainer.cpp


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