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


C++ CASW_Marine类代码示例

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


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

示例1: MIN

bool CASW_Use_Area::RequirementsMet( CBaseEntity *pUser )
{
	int nPlayersRequired = MIN( m_nPlayersRequired, ASWGameResource()->CountAllAliveMarines() );

	if ( nPlayersRequired <= 1 )
	{
		return true;
	}

	int nTouchingMarines = 0;

	for ( int nEnt = 0; nEnt < m_hTouchingEntities.Count(); ++nEnt )
	{
		CASW_Marine *pMarine = dynamic_cast<CASW_Marine *>( m_hTouchingEntities[ nEnt ].Get() );

		if ( pMarine && pMarine->IsAlive() && !pMarine->m_bKnockedOut )
		{
			nTouchingMarines++;
		}
	}

	if ( nTouchingMarines >= nPlayersRequired )
	{
		return true;
	}

	m_OnRequirementFailed.FireOutput( pUser, this );

	return false;
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:30,代码来源:asw_use_area.cpp

示例2: Assert

bool CASWTraceFilterShot::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask )
{
	Assert( pHandleEntity );
	if ( !PassServerEntityFilter( pHandleEntity, m_pPassEnt2 ) )
		return false;
	
	CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity );

	// don't collide with other projectiles
	if ( dynamic_cast<CASW_Flamer_Projectile*>( pEntity ) != NULL )
		return false;

	if ( dynamic_cast<CASW_Extinguisher_Projectile*>( pEntity ) != NULL )
		return false;

	if ( pEntity && pEntity->Classify() == CLASS_ASW_MARINE )
	{
		if ( m_bSkipMarines )
			return false;

		CASW_Marine *pMarine = assert_cast<CASW_Marine*>( pEntity );
		if ( m_bSkipRollingMarines && pMarine->GetCurrentMeleeAttack() && pMarine->GetCurrentMeleeAttack()->m_nAttackID == CASW_Melee_System::s_nRollAttackID )
			return false;

		if ( m_bSkipMarinesReflectingProjectiles && pMarine->IsReflectingProjectiles() )
			return false;
	}

	if ( m_bSkipAliens && pEntity && IsAlienClass( pEntity->Classify() ) )
		return false;

	return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask );
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:33,代码来源:asw_trace_filter_shot.cpp

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

示例4: asw_alien_batch_f

// creates a batch of aliens at the mouse cursor
void asw_alien_batch_f( const CCommand& args )
{
    MDLCACHE_CRITICAL_SECTION();

    bool allowPrecache = CBaseEntity::IsPrecacheAllowed();
    CBaseEntity::SetAllowPrecache( true );

    // find spawn point
    CASW_Player* pPlayer = ToASW_Player(UTIL_GetCommandClient());
    if (!pPlayer)
        return;
    CASW_Marine *pMarine = pPlayer->GetMarine();
    if (!pMarine)
        return;
    trace_t tr;
    Vector forward;

    AngleVectors( pMarine->EyeAngles(), &forward );
    UTIL_TraceLine(pMarine->EyePosition(),
                   pMarine->EyePosition() + forward * 300.0f,MASK_SOLID,
                   pMarine, COLLISION_GROUP_NONE, &tr );
    if ( tr.fraction != 0.0 )
    {
        // trace to the floor from this spot
        Vector vecSrc = tr.endpos;
        tr.endpos.z += 12;
        UTIL_TraceLine( vecSrc + Vector(0, 0, 12),
                        vecSrc - Vector( 0, 0, 512 ) ,MASK_SOLID,
                        pMarine, COLLISION_GROUP_NONE, &tr );

        ASWSpawnManager()->SpawnAlienBatch( "asw_parasite", 25, tr.endpos, vec3_angle );
    }

    CBaseEntity::SetAllowPrecache( allowPrecache );
}
开发者ID:docfinorlias,项目名称:asb2,代码行数:36,代码来源:asw_spawn_manager.cpp

示例5: InputGenerateEvent

//-----------------------------------------------------------------------------
// Purpose: Input handler for showing the message and/or playing the sound.
//-----------------------------------------------------------------------------
void CPointEventProxy::InputGenerateEvent( inputdata_t &inputdata )
{
	IGameEvent * event = gameeventmanager->CreateEvent( m_iszEventName.ToCStr() );
	if ( event )
	{
		CBasePlayer *pActivator = NULL;

#ifdef INFESTED_DLL
		CASW_Marine *pMarine = dynamic_cast< CASW_Marine* >( inputdata.pActivator );
		if ( pMarine )
		{
			pActivator = pMarine->GetCommander();
		}
#else
		pActivator = dynamic_cast< CBasePlayer* >( inputdata.pActivator );
#endif

		if ( m_bActivatorAsUserID )
		{
			event->SetInt( "userid", ( pActivator ? pActivator->GetUserID() : 0 ) );
		}

		gameeventmanager->FireEvent( event );
	}
}
开发者ID:Ch1ckenscoop,项目名称:svn,代码行数:28,代码来源:point_event_proxy.cpp

示例6: GetMarine

float	CASW_Weapon_Pistol::GetFireRate( void )
{
	CASW_Marine *pMarine = GetMarine();

	float flRate = GetWeaponInfo()->m_flFireRate;

	// player firing rate
	if (!pMarine || pMarine->IsInhabited())
	{
		return flRate;
	}

#ifdef CLIENT_DLL
	return flRate;

#else
	float randomness = 0.1f * random->RandomFloat() - 0.05f;

	// AI firing rate: depends on distance to enemy
	if (!pMarine->GetEnemy())
		return 0.3f + randomness;

	float dist = pMarine->GetAbsOrigin().DistTo(pMarine->GetEnemy()->GetAbsOrigin());
	if (dist > 500)
		return 0.3f + randomness;

	if (dist < 100)
		return 0.14f + randomness;

	float factor = (dist - 100) / 400.0f;
	return 0.14f + factor * 0.16f + randomness;
#endif
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:33,代码来源:asw_weapon_pistol_shared.cpp

示例7: GetCommander

const QAngle& CASW_Weapon_Smart_Bomb::GetRocketAngle()
{
	static QAngle angRocket = vec3_angle;
	CASW_Player *pPlayer = GetCommander();
	CASW_Marine *pMarine = GetMarine();
	if ( !pPlayer || !pMarine || pMarine->GetHealth() <= 0 )
	{
		return angRocket;
	}

	//Vector vecDir = pPlayer->GetAutoaimVectorForMarine(pMarine, GetAutoAimAmount(), GetVerticalAdjustOnlyAutoAimAmount());	// 45 degrees = 0.707106781187
	//VectorAngles( vecDir, angRocket );
	//angRocket[ YAW ] += random->RandomFloat( -35, 35 );
	angRocket[ PITCH ] = -60.0f;	// aim up to help avoid FF
	if ( GetRocketsToFire() % 2 )
	{
		angRocket[ YAW ] = m_iRocketsToFire * 15.0f;	// 15 degrees between each rocket
	}
	else
	{
		angRocket[ YAW ] = RandomFloat( 0.0f, 360.0f );
	}
	angRocket[ ROLL ] = 0;
	return angRocket;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:25,代码来源:asw_weapon_smart_bomb.cpp

示例8: asw_gimme_ammo_f

void asw_gimme_ammo_f(void)
{
	CASW_Game_Resource *pGameResource = ASWGameResource();
	if ( !pGameResource )
		return;

	for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
	{
		if (pGameResource->GetMarineResource(i) != NULL && pGameResource->GetMarineResource(i)->GetMarineEntity())
		{
			CASW_Marine *pMarine = pGameResource->GetMarineResource(i)->GetMarineEntity();
			for (int k=0;k<ASW_MAX_MARINE_WEAPONS;k++)
			{
				CASW_Weapon *pWeapon = pMarine->GetASWWeapon(k);
				if (!pWeapon)
					continue;

				// refill bullets in the gun
				pWeapon->m_iClip1 = pWeapon->GetMaxClip1();
				pWeapon->m_iClip2 = pWeapon->GetMaxClip2();

				// give the marine a load of ammo of that type
				pMarine->GiveAmmo(10000, pWeapon->GetPrimaryAmmoType());
				pMarine->GiveAmmo(10000, pWeapon->GetSecondaryAmmoType());
			}
		}
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:28,代码来源:asw_concommands.cpp

示例9: SetNextThink

void CASW_Parasite::InfestThink( void )
{	
	SetNextThink( gpGlobals->curtime + 0.1f );

	if ( !GetModelPtr() )
		return;
	
	StudioFrameAdvance();

	DispatchAnimEvents( this );

	CASW_Marine *pMarine = dynamic_cast<CASW_Marine*>(GetParent());
	CASW_Colonist *pColonist = dynamic_cast<CASW_Colonist*>(GetParent());

	if (!pColonist) {
	if ( !pMarine || !pMarine->IsInfested() || pMarine->IsEffectActive( EF_NODRAW ) )
	{
		FinishedInfesting();
	}
	}

	if (!pMarine) {
		if ( !pColonist || !pColonist->IsInfested() || pColonist->IsEffectActive( EF_NODRAW ) )
		{
			FinishedInfesting();
		}
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:28,代码来源:asw_parasite.cpp

示例10: Msg

bool CASW_Spawn_Manager::AddHorde( int iHordeSize )
{
    m_iHordeToSpawn = iHordeSize;

    if ( m_vecHordePosition == vec3_origin )
    {
        if ( !FindHordePosition() )
        {
            Msg("Error: Failed to find horde position\n");
            return false;
        }
        else
        {
            if ( asw_director_debug.GetBool() )
            {
                NDebugOverlay::Cross3D( m_vecHordePosition, 50.0f, 255, 128, 0, true, 60.0f );
                float flDist;
                CASW_Marine *pMarine = UTIL_ASW_NearestMarine( m_vecHordePosition, flDist );
                if ( pMarine )
                {
                    NDebugOverlay::Line( pMarine->GetAbsOrigin(), m_vecHordePosition, 255, 128, 0, true, 60.0f );
                }
            }
        }
    }
    return true;
}
开发者ID:docfinorlias,项目名称:asb2,代码行数:27,代码来源:asw_spawn_manager.cpp

示例11: GetMarine

void CASW_Weapon_Blink::DoBlink()
{
	CASW_Marine *pMarine = GetMarine();
	if ( !pMarine )
		return;

	pMarine->m_iJumpJetting = JJ_BLINK;
	pMarine->m_vecJumpJetStart = pMarine->GetAbsOrigin();
	pMarine->m_vecJumpJetEnd = m_vecAbilityDestination;
	pMarine->m_flJumpJetStartTime = gpGlobals->curtime;
	pMarine->m_flJumpJetEndTime = gpGlobals->curtime + asw_blink_time.GetFloat();

	ASWMeleeSystem()->StartMeleeAttack( ASWMeleeSystem()->GetMeleeAttackByName( "Blink" ), pMarine, ASWGameMovement()->GetMoveData() );

	// TODO:
	/*
#ifdef GAME_DLL
	// create a small stun volume at the start
	CASW_Weapon_EffectVolume *pEffect = (CASW_Weapon_EffectVolume*) CreateEntityByName("asw_weapon_effect_volume");
	if ( pEffect )
	{
		pEffect->SetAbsOrigin( pMarine->GetAbsOrigin() );
		pEffect->SetOwnerEntity( pMarine );
		pEffect->SetOwnerWeapon( NULL );
		pEffect->SetEffectFlag( ASW_WEV_ELECTRIC_BIG );
		pEffect->SetDuration( pSkill->GetValue( CASW_Skill_Details::Duration, GetSkillPoints() ) );
		pEffect->Spawn();
	}
#endif
	*/

	m_flPower = 0.0f;

	// TODO: Check for charges being zero
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:35,代码来源:asw_weapon_blink.cpp

示例12: GetMarine

void CASW_Weapon_Sniper_Rifle::ItemPostFrame( void )
{
	BaseClass::ItemPostFrame();

	CASW_Marine *pMarine = GetMarine();
	if ( !pMarine )
		return;

	// AIs switch out of zoom mode
	if ( !pMarine->IsInhabited() && IsZoomed() )
	{
		m_bZoomed = false;
	}

	bool bAttack1, bAttack2, bReload, bOldReload, bOldAttack1;
	GetButtons( bAttack1, bAttack2, bReload, bOldReload, bOldAttack1 );

	bool bOldAttack2 = false;
	if ( pMarine->IsInhabited() && pMarine->GetCommander() )
	{
		bOldAttack2 = !!(pMarine->m_nOldButtons & IN_ATTACK2);
	}

	if ( bAttack2 && !bOldAttack2 )
	{
		m_bZoomed = !IsZoomed();
	}
}
开发者ID:BenLubar,项目名称:riflemod,代码行数:28,代码来源:asw_weapon_sniper_rifle.cpp

示例13: asw_drop_ammo_f

void asw_drop_ammo_f(const CCommand &args)
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if (!pPlayer)
		return;
	
	CASW_Marine *pMarine = pPlayer->GetMarine();
	if (!pMarine)
		return;

	int iBagSlot = atoi(args[1]);

	CASW_Weapon_Ammo_Bag *pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(0));
	if (pBag)
	{
		if (pBag->DropAmmoPickup(iBagSlot))
		{
			return;
		}
	}

	pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(1));
	if (pBag)
	{
		if (pBag->DropAmmoPickup(iBagSlot))
		{
			return;
		}
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:30,代码来源:asw_concommands.cpp

示例14: GetWeaponInfo

bool CASW_Weapon::ShouldAlienFlinch(CBaseEntity *pAlien, const CTakeDamageInfo &info)
{
	if (!GetWeaponInfo())
		return false;
	float fFlinchChance = GetWeaponInfo()->m_fFlinchChance;
	CASW_Marine *pMarine = dynamic_cast<CASW_Marine*>(GetOwner());
	if (asw_debug_alien_damage.GetBool())
		Msg("BaseFlinch chance %f ", fFlinchChance);
	if (pMarine && pMarine->GetMarineProfile() && pMarine->GetMarineProfile()->GetMarineClass() == MARINE_CLASS_SPECIAL_WEAPONS)
	{
		// this is a special weapons marine, so we need to add our flinch bonus onto it
		fFlinchChance += GetWeaponInfo()->m_fStoppingPowerFlinchBonus * MarineSkills()->GetSkillBasedValueByMarine(pMarine, ASW_MARINE_SKILL_STOPPING_POWER);
		if (asw_debug_alien_damage.GetBool())
			Msg("Boosted by specialweaps to %f ", fFlinchChance);
	}

	//CALL_ATTRIB_HOOK_FLOAT( fFlinchChance, mod_stopping );

	if (pAlien)
	{
		int iHealth = pAlien->GetHealth();
		int iDamage = info.GetDamage();
		float fAlienHealth = float(iHealth + iDamage) / float(pAlien->GetMaxHealth());
		fFlinchChance *= fAlienHealth;
		if (asw_debug_alien_damage.GetBool())
			Msg("adjusted by alien health (%f) to %f ", fAlienHealth, fFlinchChance);
	}

	float f = random->RandomFloat();
	bool bResult = ( f < fFlinchChance);
	if (asw_debug_alien_damage.GetBool())
		Msg("random float is %f shouldflinch = %d\n", f, bResult);
	return bResult;
}
开发者ID:TalonBraveInfo,项目名称:InvasionASSource,代码行数:34,代码来源:asw_weapon.cpp

示例15: OnTakeDamage

int CASW_Barrel_Explosive::OnTakeDamage( const CTakeDamageInfo &info )
{
	int saveFlags = m_takedamage;

	// don't be destroyed by buzzers
	if ( info.GetAttacker() && info.GetAttacker()->Classify() == CLASS_ASW_BUZZER )
	{
		return 0;
	}

	// prevent barrel exploding when knocked around
	if ( info.GetDamageType() & DMG_CRUSH )
		return 0;
	
	CASW_Marine* pMarine = NULL;
	if ( info.GetAttacker() && info.GetAttacker()->Classify() == CLASS_ASW_MARINE )
	{
		m_hAttacker = info.GetAttacker();

		pMarine = assert_cast< CASW_Marine* >( info.GetAttacker() );
		// prevent AI marines blowing up barrels as it makes the player ANGRY ANGRY
		if ( pMarine && !pMarine->IsInhabited() )
			return 0;
	}

	// don't burst open if melee'd
	if ( info.GetDamageType() & ( DMG_CLUB | DMG_SLASH ) )
	{
		m_takedamage = DAMAGE_EVENTS_ONLY;

		if( !m_bMeleeHit )
		{
			if ( pMarine )
			{
				IGameEvent * event = gameeventmanager->CreateEvent( "physics_melee" );
				if ( event )
				{
					CASW_Player *pCommander = pMarine->GetCommander();
					event->SetInt( "attacker", pCommander ? pCommander->GetUserID() : 0 );
					event->SetInt( "entindex", entindex() );
					gameeventmanager->FireEvent( event );
				}
			}
			m_bMeleeHit = true;
		}
	}

	if ( pMarine )
	{
		pMarine->HurtJunkItem(this, info);
	}

	// skip the breakable prop's complex damage handling and just hurt us
	int iResult = CBaseEntity::OnTakeDamage(info);
	m_takedamage = saveFlags;

	return iResult;
}
开发者ID:BenLubar,项目名称:riflemod,代码行数:58,代码来源:asw_barrel_explosive.cpp


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