本文整理汇总了C++中CBaseEntity::GetSolidType方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseEntity::GetSolidType方法的具体用法?C++ CBaseEntity::GetSolidType怎么用?C++ CBaseEntity::GetSolidType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseEntity
的用法示例。
在下文中一共展示了CBaseEntity::GetSolidType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsSpaceEmpty
bool IsSpaceEmpty( CBaseEntity *pEntity )
{
bool bEmpty = true;
Vector vecMins, vecMaxs;
pEntity->GetAbsBounds( &vecMins, &vecMaxs );
// World bounds!
if ( !g_ScreenRect.contains( vecMins ) || !g_ScreenRect.contains( vecMaxs ) )
{
// Screen edges are always solid.
bEmpty = false;
}
for ( int i = 0; i < MAX_ENTITIES; i++ )
{
CBaseEntity *pOther = g_EntityList[i];
if ( !pOther || pOther == pEntity || pOther->GetSolidType() == SOLID_NO )
continue;
Vector vecOtherMins, vecOtherMaxs;
pOther->GetAbsBounds( &vecOtherMins, &vecOtherMaxs );
if ( IsBoxIntersectingBox( vecMins, vecMaxs, vecOtherMins, vecOtherMaxs ) )
{
if ( pOther->IsSolid() )
{
bEmpty = false;
}
}
}
return bEmpty;
}
示例2: ProcessMovement
//-----------------------------------------------------------------------------
// Purpose: "Physics" simulation.
//-----------------------------------------------------------------------------
void CBaseEntity::ProcessMovement( void )
{
// Test new position.
Vector vecNewOrigin = m_vecOrigin + m_vecVelocity * g_FrameTime;
Vector vecMins = vecNewOrigin + m_vecMins;
Vector vecMaxs = vecNewOrigin + m_vecMaxs;
// Test collision against other entities.
// Since movement amount depends on frame time and we only test the final position
// this whole system goes out of the window at low framerates.
bool bCanMove = true;
if ( GetSolidType() != SOLID_NO )
{
// World bounds!
if ( !g_ScreenRect.contains( vecMins ) || !g_ScreenRect.contains( vecMaxs ) )
{
TouchScreenEdge( vecNewOrigin );
// Screen edges are always solid.
if ( IsSolid() )
{
bCanMove = false;
}
}
for ( int i = 0; i < MAX_ENTITIES; i++ )
{
CBaseEntity *pEntity = g_EntityList[i];
if ( !pEntity || pEntity == this || pEntity->GetSolidType() == SOLID_NO )
continue;
Vector vecOtherMins, vecOtherMaxs;
pEntity->GetAbsBounds( &vecOtherMins, &vecOtherMaxs );
if ( IsBoxIntersectingBox( vecMins, vecMaxs, vecOtherMins, vecOtherMaxs ) )
{
OnCollide( pEntity );
if ( IsSolid() && pEntity->IsSolid() )
{
bCanMove = false;
}
}
}
}
if ( bCanMove )
m_vecOrigin = vecNewOrigin;
// Move the sprite if we have one.
if ( m_pSprite )
{
m_pSprite->setPosition( m_vecOrigin );
m_pSprite->setRotation( m_flAngle );
}
}