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


C++ SetCycle函数代码示例

本文整理汇总了C++中SetCycle函数的典型用法代码示例。如果您正苦于以下问题:C++ SetCycle函数的具体用法?C++ SetCycle怎么用?C++ SetCycle使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetCycle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Precache

//-----------------------------------------------------------------------------
// Purpose: the entity
//-----------------------------------------------------------------------------
void CNPC_RocketTurret::Spawn( void )
{ 
	Precache();

	BaseClass::Spawn();

	SetViewOffset( vec3_origin );

	AddEFlags( EFL_NO_DISSOLVE );

	SetModel( ROCKET_TURRET_MODEL_NAME );
	SetSolid( SOLID_VPHYSICS );

	m_iMuzzleAttachment = LookupAttachment ( "barrel" );
	m_iLightAttachment = LookupAttachment ( "eye" );

	m_iPosePitch = LookupPoseParameter( "aim_pitch" );
	m_iPoseYaw   = LookupPoseParameter( "aim_yaw" );

	m_vecCurrentAngles = m_vecGoalAngles = GetAbsAngles();

	CreateVPhysics();

	//Set our autostart state
	m_bEnabled	 = ( ( m_spawnflags & SF_ROCKET_TURRET_START_INACTIVE ) == false );

	// Set Locked sprite
	if ( m_bEnabled )
	{
		m_iLaserState = 1;
		SetSequence(LookupSequence("idle"));
	}
	else
	{
		m_iLaserState = 0;
		SetSequence(LookupSequence("inactive"));
	}
	SetCycle(1.0f);
	UpdateSkin( ROCKET_SKIN_IDLE );

	SetPoseParameter( "aim_pitch", 0 );
	SetPoseParameter( "aim_yaw", -180 );

	if ( m_bEnabled )
	{
		SetThink( &CNPC_RocketTurret::FollowThink );
	}
	
	SetNextThink( gpGlobals->curtime + ROCKET_TURRET_THINK_RATE );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:53,代码来源:npc_rocket_turret.cpp

示例2: Precache

//-----------------------------------------------------------------------------
// Purpose: This used to have something to do with bees flying, but 
//			now it only initializes moving furniture in scripted sequences
//-----------------------------------------------------------------------------
void CNPC_Furniture::Spawn( )
{
	Precache();
	
	SetModel( STRING(GetModelName()) );

	SetMoveType( MOVETYPE_STEP );
	SetSolid( SOLID_BBOX );

	// Our collision, if needed, will be done through bone followers
	AddSolidFlags( FSOLID_NOT_SOLID );

	SetBloodColor( DONT_BLEED );
	m_iHealth = TOO_MUCH_HEALTH_TO_DIE; //wow
	m_takedamage = DAMAGE_AIM;
	SetSequence( 0 );
	SetCycle( 0 );
	SetNavType( NAV_FLY );
	AddFlag( FL_FLY );

	CapabilitiesAdd( bits_CAP_MOVE_FLY | bits_CAP_TURN_HEAD | bits_CAP_ANIMATEDFACE );

	AddEFlags( EFL_NO_MEGAPHYSCANNON_RAGDOLL );

//	pev->nextthink += 1.0;
//	SetThink (WalkMonsterDelay);

	ResetSequenceInfo( );
	SetCycle( 0 );
	NPCInit();

	// Furniture needs to block LOS
	SetBlocksLOS( true );

	// Furniture just wastes CPU doing sensing code, since all they do is idle and play scripts
	GetSenses()->AddSensingFlags( SENSING_FLAGS_DONT_LOOK | SENSING_FLAGS_DONT_LISTEN );
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:41,代码来源:genericmonster.cpp

示例3: SetNextThink

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropJetski::Think(void)
{
	BaseClass::Think();
	
	// set handbrake after physics sim settles down
	if ( gpGlobals->curtime < m_flHandbrakeTime )
	{
		SetNextThink( gpGlobals->curtime );
	}
	else if ( !m_bInitialHandbrake )	// after initial timer expires, set the handbrake
	{
		m_bInitialHandbrake = true;
		m_VehiclePhysics.SetHandbrake( true );
		m_VehiclePhysics.Think();
	}


	// play enter animation
	if ( (m_bEnterAnimOn || m_bExitAnimOn) && !IsSequenceFinished() )
	{
		StudioFrameAdvance();
	}
	else if ( IsSequenceFinished() )
	{
		if ( m_bExitAnimOn )
		{
			CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
			if ( pPlayer )
			{
				pPlayer->LeaveVehicle();		// now that sequence is finished, leave car
				Vector vecEyes;
				QAngle vecEyeAng;
				GetAttachment( "vehicle_driver_eyes", vecEyes, vecEyeAng );
				vecEyeAng.x = 0;
				vecEyeAng.z = 0;
				pPlayer->SnapEyeAngles( vecEyeAng );			
			}
			m_bExitAnimOn = false;
		}
		int iSequence = SelectWeightedSequence( ACT_IDLE );
		if ( iSequence > ACTIVITY_NOT_AVAILABLE )
		{
			SetCycle(0);
			m_flAnimTime = gpGlobals->curtime;
			ResetSequence( iSequence );
			ResetClientsideFrame();
		}
	}
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:52,代码来源:vehicle_jetski.cpp

示例4: GetModelPtr

bool C_BaseViewModel::Interpolate( float currentTime )
{
	CStudioHdr *pStudioHdr = GetModelPtr();
	// Make sure we reset our animation information if we've switch sequences
	UpdateAnimationParity();

	bool bret = BaseClass::Interpolate( currentTime );

	// Hack to extrapolate cycle counter for view model
	float elapsed_time = currentTime - m_flAnimTime;
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();

	// Predicted viewmodels have fixed up interval
	if ( GetPredictable() || IsClientCreated() )
	{
		Assert( pPlayer );
		float curtime = pPlayer ? pPlayer->GetFinalPredictedTime() : gpGlobals->curtime;
		elapsed_time = curtime - m_flAnimTime;
		// Adjust for interpolated partial frame
		if ( !engine->IsPaused() )
		{
			elapsed_time += ( gpGlobals->interpolation_amount * TICK_INTERVAL );
		}
	}

	// Prediction errors?	
	if ( elapsed_time < 0 )
	{
		elapsed_time = 0;
	}

	float dt = elapsed_time * GetSequenceCycleRate( pStudioHdr, GetSequence() ) * GetPlaybackRate();
	if ( dt >= 1.0f )
	{
		if ( !IsSequenceLooping( GetSequence() ) )
		{
			dt = 0.999f;
		}
		else
		{
			dt = fmod( dt, 1.0f );
		}
	}

	SetCycle( dt );
	return bret;
}
开发者ID:malortie,项目名称:ulaval,代码行数:47,代码来源:c_baseviewmodel.cpp

示例5: SetupVOList

void CPropGladosCore::Spawn( void )
{
	SetupVOList();

	Precache();
	KeyValue( "model", GLADOS_CORE_MODEL_NAME );
	BaseClass::Spawn();

	//Default to 'dropped' animation
	ResetSequence(LookupSequence("drop"));
	SetCycle( 1.0f );

	DisableAutoFade();
	m_iEyeballAttachment = LookupAttachment( "eyeball" );

	SetContextThink( &CPropGladosCore::AnimateThink, gpGlobals->curtime + 0.1f, s_pAnimateThinkContext );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:17,代码来源:prop_glados_core.cpp

示例6: Precache

//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CNPC_VehicleDriver::Spawn( void )
{
	Precache( );

	BaseClass::Spawn();

	CapabilitiesClear();
	CapabilitiesAdd( bits_CAP_MOVE_GROUND );
	CapabilitiesAdd( bits_CAP_MOVE_SHOOT );

	SetModel( "models/roller_vehicledriver.mdl" );
	SetHullType(HULL_LARGE);
	SetHullSizeNormal();
	m_iMaxHealth = m_iHealth = 1;
	m_flFieldOfView	= VIEW_FIELD_FULL;

	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_SOLID );
	SetMoveType( MOVETYPE_NONE );
	AddEffects( EF_NODRAW );

	m_lifeState	= LIFE_ALIVE;
	SetCycle( 0 );
	ResetSequenceInfo();

	AddFlag( FL_NPC );

	m_flMaxSpeed = 0;
	m_flGoalSpeed = m_flInitialSpeed;

	m_vecDesiredVelocity = vec3_origin;
	m_vecPrevPoint = vec3_origin;
	m_vecPrevPrevPoint = vec3_origin;
	m_vecPostPoint = vec3_origin;
	m_vecPostPostPoint = vec3_origin;
	m_vecDesiredPosition = vec3_origin;
	m_flSteering = 45;
	m_flDistanceAlongSpline = 0.2;
	m_pCurrentWaypoint = m_pNextWaypoint = NULL;

	GetNavigator()->SetPathcornerPathfinding( false );

	NPCInit();

	m_takedamage = DAMAGE_NO;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:49,代码来源:npc_vehicledriver.cpp

示例7: Precache

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CAntlionGrub::Spawn( void )
{
	Precache();
	BaseClass::Spawn();

	SetModel( ANTLIONGRUB_MODEL );
	
	// FIXME: This is a big perf hit with the number of grubs we're using! - jdw
	CreateGlow();

	SetSolid( SOLID_BBOX );
	SetSolidFlags( FSOLID_TRIGGER );
	SetMoveType( MOVETYPE_NONE );
	SetCollisionGroup( COLLISION_GROUP_NONE );
	AddEffects( EF_NOSHADOW );

	CollisionProp()->UseTriggerBounds(true,1);

	SetTouch( &CAntlionGrub::GrubTouch );

	SetHealth( 1 );
	m_takedamage = DAMAGE_YES;

	// Stick to the nearest surface
	if ( HasSpawnFlags( SF_ANTLIONGRUB_NO_AUTO_PLACEMENT ) == false )
	{
		AttachToSurface();
	}

	// At this point, alter our bounds to make sure we're within them
	Vector vecMins, vecMaxs;
	RotateAABB( EntityToWorldTransform(), CollisionProp()->OBBMins(), CollisionProp()->OBBMaxs(), vecMins, vecMaxs );

	UTIL_SetSize( this, vecMins, vecMaxs );

	// Start our idle activity
	SetSequence( SelectWeightedSequence( ACT_IDLE ) );
	SetCycle( random->RandomFloat( 0.0f, 1.0f ) );
	ResetSequenceInfo();

	m_State = GRUB_STATE_IDLE;

	// Reset
	m_flFlinchTime = 0.0f;
	m_flNextIdleSoundTime = gpGlobals->curtime + random->RandomFloat( 4.0f, 8.0f );
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:49,代码来源:npc_antliongrub.cpp

示例8: SetSolid

void CWreckage::Spawn( void )
{
	SetSolid( SOLID_NONE );
	SetMoveType( MOVETYPE_NONE );
	m_takedamage		= 0;

	SetCycle( 0 );
	SetNextThink( gpGlobals->curtime + 0.1f );

	if (GetModelName() != NULL_STRING)
	{
		PrecacheModel( STRING( GetModelName() ) );
		SetModel( STRING( GetModelName() ) );
	}

	m_flStartTime		= gpGlobals->curtime;
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:17,代码来源:h_cycler.cpp

示例9: SetCycle

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CRagdollProp::InitRagdollAnimation()
{
	m_flAnimTime = gpGlobals->curtime;
	m_flPlaybackRate = 0.0;
	SetCycle( 0 );
	
	// put into ACT_DIERAGDOLL if it exists, otherwise use sequence 0
	int nSequence = SelectWeightedSequence( ACT_DIERAGDOLL );
	if ( nSequence < 0 )
	{
		ResetSequence( 0 );
	}
	else
	{
		ResetSequence( nSequence );
	}
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:20,代码来源:physics_prop_ragdoll.cpp

示例10: IsIntermediateDataAllocated

//-----------------------------------------------------------------------------
// Purpose: If the animation parity of the weapon has changed, we reset cycle to avoid popping
//-----------------------------------------------------------------------------
void C_BaseViewModel::UpdateAnimationParity( void )
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	
	// If we're predicting, then we don't use animation parity because we change the animations on the clientside
	// while predicting. When not predicting, only the server changes the animations, so a parity mismatch
	// tells us if we need to reset the animation.
	if ( m_nOldAnimationParity != m_nAnimationParity && !GetPredictable() )
	{
		float curtime = (pPlayer && IsIntermediateDataAllocated()) ? pPlayer->GetFinalPredictedTime() : gpGlobals->curtime;
		// FIXME: this is bad
		// Simulate a networked m_flAnimTime and m_flCycle
		// FIXME:  Do we need the magic 0.1?
		SetCycle( 0.0f ); // GetSequenceCycleRate( GetSequence() ) * 0.1;
		m_flAnimTime = curtime;
	}
}
开发者ID:malortie,项目名称:ulaval,代码行数:20,代码来源:c_baseviewmodel.cpp

示例11: INIT_Frame

ULONG INIT_Frame(piClass *cl,piObject *o,Msg msg)
{
	struct Node_Frame *nf;
	ULONG active=0;
	struct Window *PropsWnd=NULL;

	piGetAttr(o,OBJ_Node,(ULONG *)&nf);
	GetAttr(PAGE_Active,PropertiesGadgets[GD_PROPERTIES_PAGES], &active);

	if(active==0) PropsWnd=PropertiesWnd; else PropsWnd=NULL;
	SetInteger(PropsWnd,PGFR_GeneralGadgets[GD_PGFR_X],nf->nf_X);
	SetInteger(PropsWnd,PGFR_GeneralGadgets[GD_PGFR_Y],nf->nf_Y);
	SetInteger(PropsWnd,PGFR_GeneralGadgets[GD_PGFR_WIDTH],nf->nf_Width);
	SetInteger(PropsWnd,PGFR_GeneralGadgets[GD_PGFR_HEIGHT],nf->nf_Height);
	SetCycle(PropsWnd,PGFR_GeneralGadgets[GD_PGFR_FRAME],nf->nf_FrameType);
	SetCheckMark(PropsWnd,PGFR_GeneralGadgets[GD_PGFR_RECESSED],(nf->nf_Flags&MYFR_Recessed)?TRUE:FALSE);
	return TRUE;
}
开发者ID:thom-ek,项目名称:GadToolsBox,代码行数:18,代码来源:frame.c

示例12: LookupSequence

//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPropVehicleChoreoGeneric::InputOpen( inputdata_t &inputdata )
{
	int nSequence = LookupSequence( "open" );

	// Set to the desired anim, or default anim if the desired is not present
	if ( nSequence > ACTIVITY_NOT_AVAILABLE )
	{
		SetCycle( 0 );
		m_flAnimTime = gpGlobals->curtime;
		ResetSequence( nSequence );
		ResetClientsideFrame();
	}
	else
	{
		// Not available try to get default anim
		Msg( "Choreo Generic Vehicle %s: missing open sequence\n", GetDebugName() );
		SetSequence( 0 );
	}
}
开发者ID:P1x3lF3v3r,项目名称:Estranged-Act-1,代码行数:22,代码来源:vehicle_choreo_generic.cpp

示例13: SetCycle

void CNewWallHealth::StudioFrameAdvance( void )
{
	m_flPlaybackRate = 0;

	float flMaxJuice = sk_healthcharger.GetFloat();
	
	SetCycle( 1.0f - (float)( m_flJuice / flMaxJuice ) );
//	Msg( "Cycle: %f - Juice: %d - m_flJuice :%f - Interval: %f\n", (float)GetCycle(), (int)m_iJuice, (float)m_flJuice, GetAnimTimeInterval() );

	if ( !m_flPrevAnimTime )
	{
		m_flPrevAnimTime = gpGlobals->curtime;
	}

	// Latch prev
	m_flPrevAnimTime = m_flAnimTime;
	// Set current
	m_flAnimTime = gpGlobals->curtime;
}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:19,代码来源:item_healthkit.cpp

示例14: SetCycle

void CAnimating::ResetSequence(int nSequence)
{
	if ( !SequenceLoops() )
	{
		SetCycle( 0 );
	}

	// Tracker 17868:  If the sequence number didn't actually change, but you call resetsequence info, it changes
	//  the newsequenceparity bit which causes the client to call m_flCycle.Reset() which causes a very slight 
	//  discontinuity in looping animations as they reset around to cycle 0.0.  This was causing the parentattached
	//  helmet on barney to hitch every time barney's idle cycled back around to its start.
	bool changed = nSequence != GetSequence() ? true : false;

	SetSequence( nSequence );
	if ( changed || !SequenceLoops() )
	{
		ResetSequenceInfo();
	}
}
开发者ID:KissLick,项目名称:sourcemod-npc-in-css,代码行数:19,代码来源:CAnimating.cpp

示例15: SetCycle

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : eNewActivity - 
//-----------------------------------------------------------------------------
void CNPC_Crow::OnChangeActivity( Activity eNewActivity )
{
//	if ( eNewActivity == ACT_FLY )
//	{
//		m_flGroundSpeed = CROW_AIRSPEED;
//	}
//
	bool fRandomize = false;
	if ( eNewActivity == ACT_FLY )
	{
		fRandomize = true;
	}

	BaseClass::OnChangeActivity( eNewActivity );
	if ( fRandomize )
	{
		SetCycle( random->RandomFloat( 0.0, 0.75 ) );
	}
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:23,代码来源:npc_crow.cpp


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