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


C++ ASWGameRules函数代码示例

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


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

示例1: ASWGameRules

//------------------------------------------------------------------------------
// Purpose: 
// Input  : 
// Output : 
//------------------------------------------------------------------------------
bool CAI_ASW_MeleeBehavior::BehaviorHandleAnimEvent( animevent_t *pEvent )
{
	int nEvent = pEvent->Event();

	if ( nEvent == AE_ALIEN_MELEE_HIT )
	{
		float flMinDamage = ASWGameRules()->ModifyAlienDamageBySkillLevel( m_flMinDamage );
		float flMaxDamage = ASWGameRules()->ModifyAlienDamageBySkillLevel( m_flMaxDamage );

		flMinDamage = ( flMinDamage < 1.0f ? 1.0f : flMinDamage );
		flMaxDamage = ( flMaxDamage < 1.0f ? 1.0f : flMaxDamage );

		HullAttack( m_flMaxRange, RandomFloat( flMinDamage, flMaxDamage ), m_flForce, m_AttackHitSound, m_MissHitSound );
		return true;
	}

/*
		case BEHAVIOR_EVENT_MELEE1_SPHERE_ATTACK:
			{
				float flMinDamage = ASWGameRules()->ModifyAlienDamageBySkillLevel( m_flMinDamage );
				float flMaxDamage = ASWGameRules()->ModifyAlienDamageBySkillLevel( m_flMaxDamage );

				flMinDamage = ( flMinDamage < 1.0f ? 1.0f : flMinDamage );
				flMaxDamage = ( flMaxDamage < 1.0f ? 1.0f : flMaxDamage );

				SphereAttack( m_flMaxRange, RandomFloat( flMinDamage, flMaxDamage ), m_flForce, m_AttackHitSound, m_MissHitSound );
				return true;
			}
			break;
			*/
	
	return false;
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:38,代码来源:asw_ai_behavior_melee.cpp

示例2: FrameUpdatePostEntityThink

void CASW_Director::FrameUpdatePostEntityThink()
{
	// only think when we're in-game
	if ( !ASWGameRules() || ASWGameRules()->GetGameState() != ASW_GS_INGAME )
		return;

	UpdateIntensity();

	if ( ASWSpawnManager() )
	{
		ASWSpawnManager()->Update();
	}

	UpdateMarineRooms();

	if ( !asw_spawning_enabled.GetBool() )
		return;

	UpdateHorde();

	UpdateSpawningState();

	bool bWanderersEnabled = m_bWanderersEnabled || asw_wanderer_override.GetBool();
	if ( bWanderersEnabled )
	{
		UpdateWanderers();
	}
}
开发者ID:BenLubar,项目名称:riflemod,代码行数:28,代码来源:asw_director.cpp

示例3: ASW_TestRoute_cc

void ASW_TestRoute_cc(const CCommand &args)
{
	if ( args.ArgC() < 3 )
	{
		Warning( "Usage: ASW_TestRoute [start mission index] [end mission index]\n" );
		return;
	}
	if (!ASWGameRules() || !ASWGameRules()->GetCampaignSave())
	{
		Msg("Must be playing a campaign game!\n");
		return;
	}
	int iStart = atoi(args[1]);
	int iEnd = atoi(args[2]);
	CASW_Campaign_Save* pSave = ASWGameRules()->GetCampaignSave();
	bool bFound = pSave->BuildCampaignRoute(iStart, iEnd);
	if (bFound)
	{		
		Msg("Found route:\n");
		pSave->DebugBuiltRoute();
	}
	else
	{
		Msg("No route found!\n");
	}
}
开发者ID:jtanx,项目名称:ch1ckenscoop,代码行数:26,代码来源:asw_campaign_save.cpp

示例4: asw_mission_complete_f

void asw_mission_complete_f()
{
	if (!ASWGameRules())
		return;
	
	ASWGameRules()->CheatCompleteMission();
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:7,代码来源:asw_concommands.cpp

示例5: AllMarinesKnockedOut

bool CASW_Mission_Manager::AllMarinesKnockedOut()
{
	if (!ASWGameRules() || !ASWGameResource())
		return false;

	// can't be all dead if we haven't left briefing yet!
	if (ASWGameRules()->GetGameState() < ASW_GS_INGAME)
		return false;

	int iMax = ASWGameResource()->GetMaxMarineResources();
	for (int i=0;i<iMax;i++)
	{
		CASW_Marine_Resource *pMarineResource = ASWGameResource()->GetMarineResource(i);
		if (pMarineResource)
		{
			CASW_Marine *m = pMarineResource->GetMarineEntity();
			if (m)
			{
				if (!m->m_bKnockedOut)
				{
					return false;
				}
			}
		}
	}
	return true;
}
开发者ID:BenLubar,项目名称:riflemod,代码行数:27,代码来源:asw_mission_manager.cpp

示例6: Msg

void CASW_Campaign_Save::MoveThink()
{
	if (m_iMoveDestination != -1)
	{
		if (m_iMoveDestination == m_iCurrentPosition)
		{
			Msg("arrived!\n");
			// notify game rules that we've arrived, so it can do any mission launching it desires
			if (ASWGameRules())
				ASWGameRules()->RequestCampaignLaunchMission(m_iCurrentPosition);
		}
		else
		{
			// build a route to the dest from current position
			bool bRoute = BuildCampaignRoute(m_iMoveDestination, m_iCurrentPosition);
			if (!bRoute)
			{
				Msg("Couldn't build route to dest\n");
				SetThink(NULL);
			}
			else
			{
				// we've got a route, move ourselves to the next step in the route
				campaign_route_node_t* pNode = FindMissionInClosedList(m_iRouteDest);
				if (pNode)
					pNode = FindMissionInClosedList(pNode->iParentMission);
				MoveTo(pNode->iMission);
				SetNextThink(gpGlobals->curtime + 1.0f);	// move again in 1 second
			}
		}
	}
}
开发者ID:jtanx,项目名称:ch1ckenscoop,代码行数:32,代码来源:asw_campaign_save.cpp

示例7: ASWSpawnManager

void CASW_Director::OnMissionStarted()
{
	// if we have wanders turned on, spawn a couple of encounters
	if ( asw_wanderer_override.GetBool() && ASWGameRules() )
	{
		ASWSpawnManager()->SpawnRandomShieldbug();

		int nParasites = 1;
		switch( ASWGameRules()->GetSkillLevel() )
		{
			case 1: nParasites = RandomInt( 4, 6 ); break;
			default:
			case 2: nParasites = RandomInt( 4, 6 ); break;
			case 3: nParasites = RandomInt( 5, 7 ); break;
			case 4: nParasites = RandomInt( 5, 9 ); break;
			case 5: nParasites = RandomInt( 5, 10 ); break;
		}
		while ( nParasites > 0 )
		{
			int nParasitesInThisPack = RandomInt( 3, 6 );
			if ( ASWSpawnManager()->SpawnRandomParasitePack( nParasitesInThisPack ) )
			{
				nParasites -= nParasitesInThisPack;
			}
			else
			{
				break;
			}
		}
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:31,代码来源:asw_director.cpp

示例8: ASWGameRules

// NOTE: This function breaks IBriefing abstraction
bool CNB_Skill_Panel::CanSpendPoint()
{
	if ( !ASWGameRules() || m_nProfileIndex == -1 )
		return false;

	return ASWGameRules()->CanSpendPoint( C_ASW_Player::GetLocalASWPlayer(), m_nProfileIndex, m_nSkillSlot );
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:8,代码来源:nb_skill_panel.cpp

示例9: SetHullType

void CASW_Parasite::Spawn( void )
{	
	SetHullType(HULL_TINY);

	BaseClass::Spawn();

	SetModel( SWARM_PARASITE_MODEL);

	if (FClassnameIs(this, "asw_parasite_defanged"))
	{
		m_bDefanged = true;
		m_iHealth	= ASWGameRules()->ModifyAlienHealthBySkillLevel(10);
		SetBodygroup( 0, 1 );
		m_fSuicideTime = gpGlobals->curtime + 60;
	}
	else
	{
		m_bDefanged = false;
		m_iHealth	= ASWGameRules()->ModifyAlienHealthBySkillLevel(25);
		SetBodygroup( 0, 0 );
		m_fSuicideTime = 0;
	}

	SetMoveType( MOVETYPE_STEP );
	SetHullType(HULL_TINY);
	SetCollisionGroup( ASW_COLLISION_GROUP_PARASITE );
	SetViewOffset( Vector(6, 0, 11) ) ;		// Position of the eyes relative to NPC's origin.

	m_NPCState	= NPC_STATE_NONE;

	CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_INNATE_RANGE_ATTACK1 );

	m_bInfesting = false;
	
}
开发者ID:detoxhby,项目名称:SwarmDirector2,代码行数:35,代码来源:asw_parasite.cpp

示例10: ShouldDraw

//-----------------------------------------------------------------------------
// Purpose: Hide all the ASW hud in certain cases
//-----------------------------------------------------------------------------
bool CASW_HudElement::ShouldDraw( void )
{
	if (!CHudElement::ShouldDraw())
		return false;

	if (engine->IsLevelMainMenuBackground())
		return false;

	if (ASWGameRules())
	{
		if (ASWGameRules()->IsIntroMap() || ASWGameRules()->IsOutroMap())
			return false;
	}

	C_ASW_Player *pASWPlayer = C_ASW_Player::GetLocalASWPlayer();
	C_ASW_Marine *pMarine = pASWPlayer ? pASWPlayer->GetViewMarine() : NULL;
	// hide things due to turret control
	if ( ( m_iHiddenBits & HIDEHUD_REMOTE_TURRET ) && pMarine && pMarine->IsControllingTurret() )
		return false;
	if ( ( m_iHiddenBits & HIDEHUD_PLAYERDEAD ) && ( !pMarine || pMarine->GetHealth() <= 0 ) )
		return false;

	if ( !asw_draw_hud.GetBool() )
		return false;

	return true;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:30,代码来源:asw_hudelement.cpp

示例11: GetCommander

void CASW_Weapon_Hornet_Barrage::FireRocket()
{
	CASW_Player *pPlayer = GetCommander();
	CASW_Marine *pMarine = GetMarine();
	if ( !pPlayer || !pMarine || pMarine->GetHealth() <= 0 )
	{
		m_iRocketsToFire = 0;
		return;
	}

	WeaponSound(SINGLE);

	// tell the marine to tell its weapon to draw the muzzle flash
	pMarine->DoMuzzleFlash();

	pMarine->DoAnimationEvent( PLAYERANIMEVENT_FIRE_GUN_PRIMARY );

	Vector vecSrc	 = GetRocketFiringPosition();
	m_iRocketsToFire = m_iRocketsToFire.Get() - 1;
	m_flNextLaunchTime = gpGlobals->curtime + m_flFireInterval.Get();

#ifndef CLIENT_DLL
	float fGrenadeDamage = MarineSkills()->GetSkillBasedValueByMarine(pMarine, ASW_MARINE_SKILL_GRENADES, ASW_MARINE_SUBSKILL_GRENADE_HORNET_DMG );

	CASW_Rocket::Create( fGrenadeDamage, vecSrc, GetRocketAngle(), pMarine, this );

	if ( ASWGameRules() )
	{
		ASWGameRules()->m_fLastFireTime = gpGlobals->curtime;
	}

	pMarine->OnWeaponFired( this, 1 );

#endif
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:35,代码来源:asw_weapon_hornet_barrage.cpp

示例12: GetAbsAngles

void CASW_Boomer_Blob::Touch( CBaseEntity *pOther )
{
	if ( !pOther || pOther == GetOwnerEntity() )
	{
		return;
	}

	if ( !pOther->IsSolid() || pOther->IsSolidFlagSet( FSOLID_VOLUME_CONTENTS ) )
	{
		return;
	}

/*
	if ( pOther == GetWorldEntity() )
	{
		// lay flat
		QAngle angMortar = GetAbsAngles();
		SetAbsAngles( QAngle( 0, angMortar.x, 0 ) );

		SetAbsVelocity( vec3_origin );
	}
*/

	if ( m_bExplodeOnWorldContact )
	{
		Detonate();
	}

	// make sure we don't die on things we shouldn't
	if ( !ASWGameRules() || !ASWGameRules()->ShouldCollide( GetCollisionGroup(), pOther->GetCollisionGroup() ) )
	{
		return;
	}

	if ( pOther->m_takedamage == DAMAGE_NO )
	{
		if (GetAbsVelocity().Length2D() > 60)
		{
			EmitSound("Grenade.ImpactHard");
		}
	}

	// can't detonate yet?
	if ( gpGlobals->curtime < m_fEarliestTouchDetonationTime )
	{
		return;
	}

	// we don't want the mortar grenade to explode on impact of marine's because 
	// it's more fun to have them avoid the area it landed in than to take blind damage
	/*
	if ( pOther->m_takedamage != DAMAGE_NO )
	{
		if ( pOther->IsNPC() && pOther->Classify() != CLASS_PLAYER_ALLY_VITAL )
		{
			Detonate();
		}
	}*/
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:59,代码来源:asw_boomer_blob.cpp

示例13: ASWGameRules

bool CASW_Briefing::UsingFixedSkillPoints()
{
	if ( !IsCampaignGame() || !ASWGameRules() || !ASWGameRules()->GetCampaignSave() )
	{
		return false;
	}
	return ASWGameRules()->GetCampaignSave()->UsingFixedSkillPoints();
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:8,代码来源:asw_briefing.cpp

示例14: Approach

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CASWInput::CalculateCameraShift( C_ASW_Player *pPlayer, float flDeltaX, float flDeltaY, float &flShiftX, float &flShiftY )
{
	// Init.
	flShiftX = 0.0f;
	flShiftY = 0.0f;

	if ( !asw_cam_marine_shift_enable.GetBool() )
		return;

	if ( m_bCameraFixed || Holdout_Resupply_Frame::HasResupplyFrameOpen() || g_asw_iPlayerListOpen > 0 || ( pPlayer && pPlayer->GetSpectatingMarine() ) )
	{
		m_fShiftFraction = Approach( 0.0f, m_fShiftFraction, gpGlobals->frametime );
	}
	else
	{
		m_fShiftFraction = Approach( 1.0f, m_fShiftFraction, gpGlobals->frametime );
	}

	if ( ASWGameRules() )
	{
		m_fShiftFraction = m_fShiftFraction * ( 1.0f - ASWGameRules()->GetMarineDeathCamInterp() );
	}

	flShiftX = flDeltaX * asw_cam_marine_shift_maxx.GetFloat() * m_fShiftFraction;
	float camshifty = (flDeltaY < 0) ? asw_cam_marine_shift_maxy.GetFloat() : asw_cam_marine_shift_maxy_south.GetFloat();
	flShiftY = flDeltaY * camshifty * m_fShiftFraction;


	return;

	// Calculate the shift, spherically, based on the cursor distance from the player.
	float flDistance = FastSqrt( flDeltaX * flDeltaX + flDeltaY * flDeltaY );
	if ( flDistance > asw_cam_marine_sphere_min.GetFloat() )
	{
		flDistance -= asw_cam_marine_sphere_min.GetFloat();

		float flRatio = 1.0f;
		if ( m_flCurrentCameraDist < asw_cam_marine_dist.GetFloat() )
		{
			flRatio = ( m_flCurrentCameraDist / asw_cam_marine_dist.GetFloat() ) * 0.8f;
		}

		float flTemp = flDistance / ( asw_cam_marine_sphere_max.GetFloat() * flRatio );
		flTemp = clamp( flTemp, 0.0f, 1.0f );

		float flAngle = atan2( (float)flDeltaY, (float)flDeltaX );
		flShiftX = cos( flAngle ) * flTemp * ( asw_cam_marine_shift_maxx.GetFloat() * flRatio );
		if ( flDeltaY < 0 )
		{
			flShiftY = sin( flAngle ) * flTemp * ( asw_cam_marine_shift_maxy.GetFloat() * flRatio );
		}
		else
		{
			flShiftY = sin( flAngle ) * flTemp * ( asw_cam_marine_shift_maxy_south.GetFloat() * flRatio );
		}
	}
}
开发者ID:LlamaSlayers,项目名称:SwarmReloaded,代码行数:60,代码来源:asw_in_camera.cpp

示例15: ASWGameResource

void DifficultyStats_t::PrepStatsForSend( CASW_Player *pPlayer )
{
	if( !steamapicontext )
		return;

	// Update stats from the briefing screen
	if( !GetDebriefStats() || !ASWGameResource() )
		return;

	CASW_Marine_Resource *pMR = ASWGameResource()->GetFirstMarineResourceForPlayer( pPlayer );
	if ( pMR )
	{
		int iMarineIndex = ASWGameResource()->GetMarineResourceIndex( pMR );
		if ( iMarineIndex != -1 )
		{
			m_iKillsTotal += GetDebriefStats()->GetKills( iMarineIndex );
			m_iFFTotal += GetDebriefStats()->GetFriendlyFire( iMarineIndex );
			m_iDamageTotal += GetDebriefStats()->GetDamageTaken( iMarineIndex );
			m_iShotsFiredTotal += GetDebriefStats()->GetShotsFired( iMarineIndex );
			m_iHealingTotal += GetDebriefStats()->GetHealthHealed( iMarineIndex );
			m_iShotsHitTotal += GetDebriefStats()->GetShotsHit( iMarineIndex );
			m_fAccuracyAvg = ( m_iShotsFiredTotal > 0 ) ? ( m_iShotsHitTotal / (float)m_iShotsFiredTotal * 100.0f ) : 0;
			m_iGamesTotal++;
			m_iGamesSuccess += ASWGameRules()->GetMissionSuccess() ? 1 : 0;
			m_fGamesSuccessPercent = m_iGamesSuccess / (float)m_iGamesTotal * 100.0f;
		}
	}
	char* szDifficulty = NULL;
	int iDifficulty = ASWGameRules()->GetSkillLevel();

	switch( iDifficulty )
	{
	case 1: szDifficulty = "easy"; 
		break;
	case 2: szDifficulty = "normal";
		break;
	case 3: szDifficulty = "hard";
		break;
	case 4: szDifficulty = "insane";
		break;
	case 5: szDifficulty = "imba";
		break;
	}
	if( szDifficulty )
	{
		SEND_STEAM_STATS( CFmtStr( "%s%s", szDifficulty, szGamesTotal ), m_iGamesTotal );
		SEND_STEAM_STATS( CFmtStr( "%s%s", szDifficulty, szGamesSuccess ), m_iGamesSuccess );
		SEND_STEAM_STATS( CFmtStr( "%s%s", szDifficulty, szGamesSuccessPercent ), m_fGamesSuccessPercent );
		SEND_STEAM_STATS( CFmtStr( "%s%s", szDifficulty, szKillsTotal ), m_iKillsTotal );
		SEND_STEAM_STATS( CFmtStr( "%s%s", szDifficulty, szDamageTotal ), m_iDamageTotal );
		SEND_STEAM_STATS( CFmtStr( "%s%s", szDifficulty, szFFTotal ), m_iFFTotal );
		SEND_STEAM_STATS( CFmtStr( "%s%s", szDifficulty, szAccuracy ), m_fAccuracyAvg );
		SEND_STEAM_STATS( CFmtStr( "%s%s", szDifficulty, szShotsHit ), m_iShotsHitTotal );
		SEND_STEAM_STATS( CFmtStr( "%s%s", szDifficulty, szShotsTotal ), m_iShotsFiredTotal );
		SEND_STEAM_STATS( CFmtStr( "%s%s", szDifficulty, szHealingTotal ), m_iHealingTotal );
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:57,代码来源:c_asw_steamstats.cpp


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