本文整理匯總了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);
}
}
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例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();
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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());
}
示例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());
}
}
}
}
}
}