当前位置: 首页>>代码示例>>C++>>正文


C++ CBaseMonster::GetSolidType方法代码示例

本文整理汇总了C++中CBaseMonster::GetSolidType方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseMonster::GetSolidType方法的具体用法?C++ CBaseMonster::GetSolidType怎么用?C++ CBaseMonster::GetSolidType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBaseMonster的用法示例。


在下文中一共展示了CBaseMonster::GetSolidType方法的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 );
		}
	}
}
开发者ID:oskarlh,项目名称:HLEnhanced,代码行数:87,代码来源:CCineAI.cpp

示例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 );
			}
		}
	}
}
开发者ID:oskarlh,项目名称:HLEnhanced,代码行数:73,代码来源:CCineMonster.cpp


注:本文中的CBaseMonster::GetSolidType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。