本文整理汇总了C++中CBaseMonster::SetAngularVelocity方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseMonster::SetAngularVelocity方法的具体用法?C++ CBaseMonster::SetAngularVelocity怎么用?C++ CBaseMonster::SetAngularVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseMonster
的用法示例。
在下文中一共展示了CBaseMonster::SetAngularVelocity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PossessEntity
// make the entity carry out the scripted sequence instructions, but without
// destroying the monster's state.
void CCineAI::PossessEntity( void )
{
Schedule_t *pNewSchedule;
CBaseEntity *pEntity = m_hTargetEnt;
CBaseMonster *pTarget = NULL;
if( pEntity )
pTarget = pEntity->MyMonsterPointer();
if( pTarget )
{
if( !pTarget->CanPlaySequence( FCanOverrideState(), SS_INTERRUPT_AI ) )
{
ALERT( at_aiconsole, "(AI)Can't possess entity %s\n", pTarget->GetClassname() );
return;
}
pTarget->m_hGoalEnt = this;
pTarget->m_pCine = this;
pTarget->m_hTargetEnt = this;
m_saved_movetype = pTarget->GetMoveType();
m_saved_solid = pTarget->GetSolidType();
m_saved_effects = pTarget->GetEffects();
pTarget->GetEffects() |= GetEffects();
switch( m_fMoveTo )
{
case 0:
case 5:
pTarget->m_scriptState = SCRIPT_WAIT;
break;
case 1:
pTarget->m_scriptState = SCRIPT_WALK_TO_MARK;
break;
case 2:
pTarget->m_scriptState = SCRIPT_RUN_TO_MARK;
break;
case 4:
{
// zap the monster instantly to the site of the script entity.
pTarget->SetAbsOrigin( GetAbsOrigin() );
pTarget->SetIdealYaw( GetAbsAngles().y );
pTarget->SetAngularVelocity( g_vecZero );
pTarget->SetAbsVelocity( Vector( 0, 0, 0 ) );
pTarget->GetEffects() |= EF_NOINTERP;
Vector vecAngles = pTarget->GetAbsAngles();
vecAngles.y = GetAbsAngles().y;
pTarget->SetAbsAngles( vecAngles );
pTarget->m_scriptState = SCRIPT_WAIT;
m_startTime = gpGlobals->time + 1E6;
// UNDONE: Add a flag to do this so people can fixup physics after teleporting monsters
pTarget->GetFlags().ClearFlags( FL_ONGROUND );
break;
}
default:
ALERT( at_aiconsole, "aiscript: invalid Move To Position value!" );
break;
}
ALERT( at_aiconsole, "\"%s\" found and used\n", pTarget->GetTargetname() );
pTarget->m_IdealMonsterState = MONSTERSTATE_SCRIPT;
/*
if (m_iszIdle)
{
StartSequence( pTarget, m_iszIdle, false );
if (FStrEq( STRING(m_iszIdle), STRING(m_iszPlay)))
{
pTarget->SetFrameRate( 0 );
}
}
*/
// Already in a scripted state?
if( pTarget->m_MonsterState == MONSTERSTATE_SCRIPT )
{
pNewSchedule = pTarget->GetScheduleOfType( SCHED_AISCRIPT );
pTarget->ChangeSchedule( pNewSchedule );
}
}
}
示例2: PossessEntity
// make the entity enter a scripted sequence
void CCineMonster::PossessEntity( void )
{
CBaseEntity *pEntity = m_hTargetEnt;
CBaseMonster *pTarget = NULL;
if( pEntity )
pTarget = pEntity->MyMonsterPointer();
if( pTarget )
{
// FindEntity() just checked this!
#if 0
if( !pTarget->CanPlaySequence( FCanOverrideState() ) )
{
ALERT( at_aiconsole, "Can't possess entity %s\n", pTarget->GetClassname() );
return;
}
#endif
pTarget->m_hGoalEnt = this;
pTarget->m_pCine = this;
pTarget->m_hTargetEnt = this;
m_saved_movetype = pTarget->GetMoveType();
m_saved_solid = pTarget->GetSolidType();
m_saved_effects = pTarget->GetEffects();
pTarget->GetEffects() |= GetEffects();
switch( m_fMoveTo )
{
case 0:
pTarget->m_scriptState = SCRIPT_WAIT;
break;
case 1:
pTarget->m_scriptState = SCRIPT_WALK_TO_MARK;
DelayStart( true );
break;
case 2:
pTarget->m_scriptState = SCRIPT_RUN_TO_MARK;
DelayStart( true );
break;
case 4:
pTarget->SetAbsOrigin( GetAbsOrigin() );
pTarget->SetIdealYaw( GetAbsAngles().y );
pTarget->SetAngularVelocity( g_vecZero );
pTarget->SetAbsVelocity( Vector( 0, 0, 0 ) );
pTarget->GetEffects() |= EF_NOINTERP;
Vector vecAngles = pTarget->GetAbsAngles();
vecAngles.y = GetAbsAngles().y;
pTarget->SetAbsAngles( vecAngles );
pTarget->m_scriptState = SCRIPT_WAIT;
m_startTime = gpGlobals->time + 1E6;
// UNDONE: Add a flag to do this so people can fixup physics after teleporting monsters
// pTarget->GetFlags().ClearFlags( FL_ONGROUND );
break;
}
// ALERT( at_aiconsole, "\"%s\" found and used (INT: %s)\n", pTarget->GetTargetname(), GetSpawnFlags().Any( SF_SCRIPT_NOINTERRUPT ) ?"No":"Yes" );
pTarget->m_IdealMonsterState = MONSTERSTATE_SCRIPT;
if( m_iszIdle )
{
StartSequence( pTarget, m_iszIdle, false );
if( FStrEq( STRING( m_iszIdle ), STRING( m_iszPlay ) ) )
{
pTarget->SetFrameRate( 0 );
}
}
}
}