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


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

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


在下文中一共展示了CBaseMonster::ChangeSchedule方法的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", 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);
		}
	}
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:83,代码来源:Scripted.cpp

示例2: 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


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