本文整理汇总了C++中CBaseMonster::CanPlaySequence方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseMonster::CanPlaySequence方法的具体用法?C++ CBaseMonster::CanPlaySequence怎么用?C++ CBaseMonster::CanPlaySequence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseMonster
的用法示例。
在下文中一共展示了CBaseMonster::CanPlaySequence方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindEntity
// find a viable entity
int CCineMonster::FindEntity(void)
{
edict_t *pentTarget;
pentTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_iszEntity));
m_hTargetEnt = NULL;
CBaseMonster *pTarget = NULL;
while(!FNullEnt(pentTarget))
{
if(FBitSet(VARS(pentTarget)->flags, FL_MONSTER))
{
pTarget = GetMonsterPointer(pentTarget);
if(pTarget && pTarget->CanPlaySequence(FCanOverrideState(), SS_INTERRUPT_BY_NAME))
{
m_hTargetEnt = pTarget;
return TRUE;
}
ALERT(at_console, "Found %s, but can't play!\n", STRING(m_iszEntity));
}
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
pTarget = NULL;
}
if(!pTarget)
{
CBaseEntity *pEntity = NULL;
while((pEntity = UTIL_FindEntityInSphere(pEntity, pev->origin, m_flRadius)) != NULL)
{
if(FClassnameIs(pEntity->pev, STRING(m_iszEntity)))
{
if(FBitSet(pEntity->pev->flags, FL_MONSTER))
{
pTarget = pEntity->MyMonsterPointer();
if(pTarget && pTarget->CanPlaySequence(FCanOverrideState(), SS_INTERRUPT_IDLE))
{
m_hTargetEnt = pTarget;
return TRUE;
}
}
}
}
}
pTarget = NULL;
m_hTargetEnt = NULL;
return FALSE;
}
示例2: FindEntity
// find a viable entity
bool CCineMonster::FindEntity()
{
m_hTargetEnt = nullptr;
CBaseEntity* pTargetEnt = nullptr;
CBaseMonster* pTarget = nullptr;
while( ( pTargetEnt = UTIL_FindEntityByTargetname( pTargetEnt, STRING( m_iszEntity ) ) ) != nullptr )
{
if( pTargetEnt->GetFlags().Any( FL_MONSTER ) )
{
pTarget = pTargetEnt->MyMonsterPointer();
if( pTarget && pTarget->CanPlaySequence( FCanOverrideState(), SS_INTERRUPT_BY_NAME ) )
{
m_hTargetEnt = pTarget;
return true;
}
ALERT( at_console, "Found %s, but can't play!\n", STRING( m_iszEntity ) );
}
pTarget = nullptr;
}
if( !pTarget )
{
pTargetEnt = nullptr;
while( ( pTargetEnt = UTIL_FindEntityInSphere( pTargetEnt, GetAbsOrigin(), m_flRadius ) ) != nullptr )
{
if( pTargetEnt->ClassnameIs( STRING( m_iszEntity ) ) )
{
if( pTargetEnt->GetFlags().Any( FL_MONSTER ) )
{
pTarget = pTargetEnt->MyMonsterPointer();
if( pTarget && pTarget->CanPlaySequence( FCanOverrideState(), SS_INTERRUPT_IDLE ) )
{
m_hTargetEnt = pTarget;
return true;
}
}
}
}
}
m_hTargetEnt = nullptr;
return false;
}
示例3: 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", STRING(pTarget->pev->classname));
return;
}
pTarget->m_pGoalEnt = this;
pTarget->m_pCine = this;
pTarget->m_hTargetEnt = this;
m_saved_movetype = pTarget->pev->movetype;
m_saved_solid = pTarget->pev->solid;
m_saved_effects = pTarget->pev->effects;
pTarget->pev->effects |= pev->effects;
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.
UTIL_SetOrigin(pTarget->pev, pev->origin);
pTarget->pev->ideal_yaw = pev->angles.y;
pTarget->pev->avelocity = Vector(0, 0, 0);
pTarget->pev->velocity = Vector(0, 0, 0);
pTarget->pev->effects |= EF_NOINTERP;
pTarget->pev->angles.y = pev->angles.y;
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->pev->flags &= ~FL_ONGROUND;
break;
default:
ALERT(at_aiconsole, "aiscript: invalid Move To Position value!");
break;
}
ALERT(at_aiconsole, "\"%s\" found and used\n", STRING(pTarget->pev->targetname));
pTarget->m_IdealMonsterState = MONSTERSTATE_SCRIPT;
/*
if (m_iszIdle)
{
StartSequence( pTarget, m_iszIdle, FALSE );
if (FStrEq( STRING(m_iszIdle), STRING(m_iszPlay)))
{
pTarget->pev->framerate = 0;
}
}
*/
// Already in a scripted state?
if(pTarget->m_MonsterState == MONSTERSTATE_SCRIPT)
{
pNewSchedule = pTarget->GetScheduleOfType(SCHED_AISCRIPT);
pTarget->ChangeSchedule(pNewSchedule);
}
}
}
示例4: 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 );
}
}
}
示例5: 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 );
}
}
}
}