本文整理汇总了C++中CGrenade::Intersects方法的典型用法代码示例。如果您正苦于以下问题:C++ CGrenade::Intersects方法的具体用法?C++ CGrenade::Intersects怎么用?C++ CGrenade::Intersects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGrenade
的用法示例。
在下文中一共展示了CGrenade::Intersects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __MAKE_VHOOK
/* <18b835> ../cstrike/dlls/training_gamerules.cpp:300 */
void CBaseGrenCatch::__MAKE_VHOOK(Think)()
{
CGrenade *pGrenade;
bool m_fSmokeTouchingLastFrame;
CBaseEntity *pTrigger;
Vector vMax, vMin;
m_fSmokeTouchingLastFrame = m_fSmokeTouching;
m_fSmokeTouching = false;
pGrenade = NULL;
while (pGrenade = (CGrenade *)UTIL_FindEntityByClassname(pGrenade, "grenade"))
{
vMin = pGrenade->pev->mins;
vMax = pGrenade->pev->maxs;
UTIL_SetSize(pGrenade->pev, Vector(-8, -8, 0), Vector(8, 8, 0));
if (pGrenade->Intersects(this) && Q_strstr(STRING(pGrenade->pev->model), "smoke") != NULL)
{
if (pGrenade->pev->velocity.Length() == 0)
m_fSmokeTouching = true;
}
pGrenade->pev->mins = vMin;
pGrenade->pev->maxs = vMax;
}
if ((m_NeedGrenadeType == GRENADETYPE_SMOKE && m_fSmokeTouching && !m_fSmokeTouchingLastFrame)
|| (m_NeedGrenadeType == GRENADETYPE_FLASH && m_fFlashTouched))
{
FireTargets(STRING(sTriggerOnGrenade), this, this, USE_TOGGLE, 0);
if (m_NeedGrenadeType == GRENADETYPE_SMOKE)
{
pTrigger = NULL;
while ((pTrigger = UTIL_FindEntityByTargetname(pTrigger, STRING(sDisableOnGrenade))) != NULL)
{
// save solid
pTrigger->pev->team = pTrigger->pev->solid;
pTrigger->pev->solid = SOLID_NOT;
}
}
else if (m_NeedGrenadeType == GRENADETYPE_FLASH)
pev->flags |= FL_KILLME;
}
if (m_fSmokeTouchingLastFrame && !m_fSmokeTouching)
{
pTrigger = NULL;
while (pTrigger = UTIL_FindEntityByTargetname(pTrigger, STRING(sDisableOnGrenade)))
{
// restore solid
pTrigger->pev->solid = pTrigger->pev->team;
pTrigger->pev->team = 0;
UTIL_SetOrigin(pTrigger->pev, pTrigger->pev->origin);
}
}
pev->nextthink = gpGlobals->time + 0.1f;
}