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


C++ SetHealth函数代码示例

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


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

示例1: Precache

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTDP_NPC_CombineS::Spawn( void )
{
	Precache();
	SetModel( STRING( GetModelName() ) );

	if( IsElite() )
	{
		// Stronger, tougher.
		SetHealth( sk_combine_guard_health.GetFloat() );
		SetMaxHealth( sk_combine_guard_health.GetFloat() );
		SetKickDamage( sk_combine_guard_kick.GetFloat() );
	}
	else
	{
		SetHealth( sk_combine_s_health.GetFloat() );
		SetMaxHealth( sk_combine_s_health.GetFloat() );
		SetKickDamage( sk_combine_s_kick.GetFloat() );
	}

	CapabilitiesAdd( bits_CAP_ANIMATEDFACE );
	CapabilitiesAdd( bits_CAP_MOVE_SHOOT );
	CapabilitiesAdd( bits_CAP_DOORS_GROUP );

	BaseClass::Spawn();
}
开发者ID:jrbedard,项目名称:troy-divine-playground,代码行数:28,代码来源:tdp_npc_combines.cpp

示例2: Precache

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CNPC_CombineS::Spawn( void )
{
	Precache();
	SetModel( STRING( GetModelName() ) );

	if( IsElite() )
	{
		// Stronger, tougher.
		SetHealth( sk_combine_guard_health.GetFloat() );
		SetMaxHealth( sk_combine_guard_health.GetFloat() );
		SetKickDamage( sk_combine_guard_kick.GetFloat() );
	}
	else
	{
		SetHealth( sk_combine_s_health.GetFloat() );
		SetMaxHealth( sk_combine_s_health.GetFloat() );
		SetKickDamage( sk_combine_s_kick.GetFloat() );
	}

	CapabilitiesAdd( bits_CAP_ANIMATEDFACE );
	CapabilitiesAdd( bits_CAP_MOVE_SHOOT );
	CapabilitiesAdd( bits_CAP_DOORS_GROUP );

	BaseClass::Spawn();

#if HL2_EPISODIC
	if (m_iUseMarch && !HasSpawnFlags(SF_NPC_START_EFFICIENT))
	{
		Msg( "Soldier %s is set to use march anim, but is not an efficient AI. The blended march anim can only be used for dead-ahead walks!\n", GetDebugName() );
	}
#endif
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:35,代码来源:npc_combines.cpp

示例3: SetHealth

int32 Unit::ModifyHealth(int32 val)
{
    int32 gain = 0;

    if (val == 0)
        return 0;

    int32 curHealth = (int32)GetHealth();

    int32 newHealth = val + curHealth;
    if (newHealth <= 0)
    {
        SetHealth(0);
        return -curHealth;
    }

    int32 maxHealth = (int32)GetMaxHealth();

    if (newHealth < maxHealth)
    {
        SetHealth(newHealth);
        gain = newHealth - curHealth;
    }
    else if (curHealth != maxHealth)
    {
        SetHealth(maxHealth);
        gain = maxHealth - curHealth;
    }

    return gain;
}
开发者ID:Fredi,项目名称:Cpp,代码行数:31,代码来源:unit.cpp

示例4: Object

Creature::Creature( const sf::Vector2f & position, CreatureType c )
	: Object( "Creature", "button.png", position, 3, 1 )
{
	creatureType = c;
	dead = false;

	strengthValues = "0123456789";

	if( creatureType == CreatureType::Dragon )
	{
		type.setString( "Dragon" );
		inStrength = rand() % 14 + 7;
		curStrength = inStrength;
		SetHealth(curStrength, inStrength);
	}
	else if( creatureType == CreatureType::Troll )
	{
		type.setString( "Troll" );
		inStrength = rand() % 14 + 7;
		curStrength = inStrength;
		SetHealth(curStrength, inStrength);
	}
	else if( creatureType == CreatureType::Skeleton )
	{
		type.setString( "Skeleton" );
		inStrength = rand() % 14 + 7;
		curStrength = inStrength;
		SetHealth(curStrength, inStrength);
	}
	else if( creatureType == CreatureType::Orc )
	{
		type.setString( "Orc" );
		inStrength = rand() % 14 + 7;
		curStrength = inStrength;
		SetHealth(curStrength, inStrength);
	}
	else if( creatureType == CreatureType::Vampire )
	{
		type.setString( "Vampire" );
		inStrength = rand() % 14 + 7;
		curStrength = inStrength;
		SetHealth(curStrength, inStrength);
	}

	font.loadFromFile("forced square.ttf");
	type.setFont( font );
	type.setCharacterSize( 52 );
	type.setColor( sf::Color(255, 51, 0) );
	type.setPosition( X(), Y() );
	sf::Vector2f t = type.findCharacterPos(8);
	type.setPosition( X() + ( 155 - ( ( t.x - X() ) / 2 ) ), Y() );

	health.setFont( font );
	health.setCharacterSize( 44 );
	health.setColor( sf::Color(80, 80, 80) );
	health.setPosition( X(), Y() );
	sf::Vector2f h = health.findCharacterPos(7);
	health.setPosition( X() + ( 155 - ( ( t.x - X() ) / 2 ) ), Y() + 92 );
}
开发者ID:RyanOConnor,项目名称:GameEngine,代码行数:59,代码来源:Creature.cpp

示例5: SetHealth

void CASW_Parasite::SetHealthByDifficultyLevel()
{
	if (FClassnameIs(this, "asw_parasite_defanged"))
	{		
		SetHealth(ASWGameRules()->ModifyAlienHealthBySkillLevel(10));
	}
	else
	{
		SetHealth(ASWGameRules()->ModifyAlienHealthBySkillLevel(30));
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:11,代码来源:asw_parasite.cpp

示例6: SetHealth

void CBurnBot::TakeDamage(IBaseObject* _pIn)
{
	 if (_pIn->GetID() == OBJ_TURRET)
	 {
		 SetHealth(GetHealth() - ((CTurret*)_pIn)->GetDamage());
		 SetWasHit(true);
	 }
	if(((CBullet*)_pIn)->GetType() == SPECIALBULLET)
		SetHealth(0.0f);
	else
		SetHealth(GetHealth() - ((CBullet*)_pIn)->GetDamage());
	SetWasHit(true);
}
开发者ID:ianalcid08,项目名称:FinalProject,代码行数:13,代码来源:BurnBot.cpp

示例7: super

cBoat::cBoat(double a_X, double a_Y, double a_Z) :
	super(etBoat, a_X, a_Y, a_Z, 0.98, 0.7)
{
	SetMass(20.f);
	SetMaxHealth(6);
	SetHealth(6);
}
开发者ID:Hillvith,项目名称:MCServer,代码行数:7,代码来源:Boat.cpp

示例8: SetExperience

void CTurtle::Update(float fElapsedTime)
{
	m_vAnimations[m_nCurrAnimation].Update(fElapsedTime);
	if(GetExperience() >= (100 * GetLevel()))
	{
		CBattleMap::GetInstance()->PlaySFX(CAssets::GetInstance()->aBMcowabungaSnd);
		SetExperience(0/*GetExperience()-(100* GetLevel())*/);
		SetLevel(GetLevel() + 1);
		SetHealthMax((int)((float)GetMaxHealth() * 1.25f));
		SetHealth((int)((float)GetMaxHealth()));
		SetBaseAP(GetBaseAP()+2);
		SetStrength( (int)( (float)GetStrength() * 1.2f ) );
		SetDefense( (int) ( (float)GetDefense() * 1.2f ) );
		SetAccuracy( (int) ( (float)GetAccuracy() * 1.2f ) );
		SetSpeed( (int) ( (float)GetSpeed() * 1.2f ) );
	}
	if( GetHealth() <= 0)
	{
		if(GetAlive() == true)
		{
			CBattleMap::GetInstance()->DecrementNumChars();
			CBattleMap::GetInstance()->DecrementNumTurtles();
			CBattleMap::GetInstance()->SetTurtleDead();
			SetAlive(false);
			if(GetCurrAnimNum() != 9)
				SetCurrAnim(9);
			SetPosZ(0.9f);
		}
	}
}
开发者ID:marvelman610,项目名称:tmntactis,代码行数:30,代码来源:Turtle.cpp

示例9: cEntity

cHangingEntity::cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z)
	: cEntity(a_EntityType, a_X, a_Y, a_Z, 0.8, 0.8)
	, m_BlockFace(a_BlockFace)
{
	SetMaxHealth(1);
	SetHealth(1);
}
开发者ID:ChriPiv,项目名称:MCServer,代码行数:7,代码来源:HangingEntity.cpp

示例10: CEnemy

CGrunt::CGrunt(float fHealthScale) : CEnemy(20)
{
	CEntity::m_eType = ENT_ENEMY;
	SetEnemyType(Grunt);

	AnimationManager::GetInstance()->LoadAnimationFile("config/Grunt_Walk_Animation.xml");
	AnimationManager::GetInstance()->LoadAnimationFile("config/Grunt_Death_Animation.xml");
	AnimationManager::GetInstance()->LoadAnimationFile("config/Grunt_Attack_Animation.xml");
	AnimationManager::GetInstance()->LoadAnimationFile("config/Grunt_Flinch_Animation.xml");
	AnimationManager::GetInstance()->LoadAnimationFile("config/Grunt_Knocked_Down_Animation.xml");

	GetAnimInfo()->SetAnimationName("Grunt_Walk_Animation");


	SetBaseAnimations(ENT_ENEMY);

	punching = false;
	cooldown = 0.0f;
	SetHealth((int)(GetHealth()*(1.0f + fHealthScale)));

	SetIdleAnim("Grunt_Walk_Animation");

	m_bFlipped = false;
	m_fMoveAway = 0.0f;
	m_bEvadeUp = false;
	m_fPosXOld = 0.0f;
	m_fPosYOld = 0.0f;
	m_fUpdateOldPos = 0.0f;
	m_nExpPts = 50;

	CSGD_EventSystem::GetInstance()->RegisterClient("New_Player", this);
	CSGD_EventSystem::GetInstance()->RegisterClient("ModifyHealth", this);
	CSGD_EventSystem::GetInstance()->RegisterClient("Self Destruct", this);
}
开发者ID:kendellm,项目名称:Trials-of-Mastery,代码行数:34,代码来源:Grunt.cpp

示例11: GetCondition

//-----------------------------------------------------------------------------
// Purpose: Touch function
//-----------------------------------------------------------------------------
bool CTFBaseDMPowerup::MyTouch( CBasePlayer *pPlayer )
{
	bool bSuccess = false;

	CTFPlayer *pTFPlayer = dynamic_cast<CTFPlayer*>( pPlayer );
	if ( pTFPlayer && ValidTouch( pPlayer ) )
	{
		// Add the condition and duration from derived classes
		pTFPlayer->m_Shared.AddCond( GetCondition(), GetEffectDuration() );

		// Give full health
		SetHealth( GetMaxHealth() );

		CSingleUserRecipientFilter user( pPlayer );
		user.MakeReliable();

		UserMessageBegin( user, "ItemPickup" );
			WRITE_STRING( GetClassname() );
		MessageEnd();

		pPlayer->EmitSound( STRING( m_strPickupSound ) );

		bSuccess = true;
	}

	return bSuccess;
}
开发者ID:Deathreus,项目名称:TF2Classic,代码行数:30,代码来源:tf_basedmpowerup.cpp

示例12: cEntity

cHangingEntity::cHangingEntity(eEntityType a_EntityType, eBlockFace a_Facing, double a_X, double a_Y, double a_Z) :
	cEntity(a_EntityType, a_X, a_Y, a_Z, 0.8, 0.8),
	m_Facing(cHangingEntity::BlockFaceToProtocolFace(a_Facing))
{
	SetMaxHealth(1);
	SetHealth(1);
}
开发者ID:1285done,项目名称:cuberite,代码行数:7,代码来源:HangingEntity.cpp

示例13: min

void Creature::SelectLevel(const CreatureInfo *cinfo)
{
    uint32 minlevel = min(cinfo->maxlevel, cinfo->minlevel);
    uint32 maxlevel = max(cinfo->maxlevel, cinfo->minlevel);
    uint32 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel);
    SetLevel(level);

    float rellevel = maxlevel == minlevel ? 0 : (float(level - minlevel))/(maxlevel - minlevel);

    uint32 minhealth = min(cinfo->maxhealth, cinfo->minhealth);
    uint32 maxhealth = max(cinfo->maxhealth, cinfo->minhealth);
    uint32 health = uint32(_GetHealthMod(isPet() ? 0 : cinfo->rank) * (minhealth + uint32(rellevel*(maxhealth - minhealth))));

    SetMaxHealth(health);
    SetUInt32Value(UNIT_FIELD_BASE_HEALTH,health);
    SetHealth(health);

    uint32 minmana = min(cinfo->maxmana, cinfo->minmana);
    uint32 maxmana = max(cinfo->maxmana, cinfo->minmana);
    uint32 mana = minmana + uint32(rellevel*(maxmana - minmana));

    SetMaxPower(POWER_MANA, mana);                          //MAX Mana
    SetUInt32Value(UNIT_FIELD_BASE_MANA, mana);
    SetPower(POWER_MANA, mana);
}
开发者ID:chrayn,项目名称:mangos-06,代码行数:25,代码来源:Creature.cpp

示例14: GetCurrentWeapon

void AMech_RPGCharacter::Reset()
{
	if (GetCurrentWeapon() != nullptr) {
		GetCurrentWeapon()->Destroy();
		SetCurrentWeapon(nullptr);
	}

	abilities.Empty();
	armour.Empty();

	if (GetInventory() != nullptr) {
		GetInventory()->GetItems().Empty();
	}

	inventory = NewObject<UInventory>(UInventory::StaticClass());

	SetHealth(GetMaxHealth());

	channeling = false;
	inCombat = false;

	canAttack = 0;
	canMove = 0;
	canBeDamaged = 0;
}
开发者ID:belven,项目名称:Mech_RPG,代码行数:25,代码来源:Mech_RPGCharacter.cpp

示例15: CEnemy

CCruiser::CCruiser(std::vector<CPlayer*>* players, BulletList* playerBullets, BulletList* enemyBullets) : CEnemy(players, playerBullets, enemyBullets)
{
	SetMesh(HAVOC_BOSS_MESH);

	//Ensure model is reset in the case it reuses a cached model
	mModel->ResetScale();
	mModel->ResetOrientation();

	mModel->RotateY(180.0f);

	mWeapon.reset(new CMissileBarrage(this, 10, 75.0f, 0.1f));
	mWeapon->SetBulletList(enemyBullets);
	mWeapon->SetEnemyBulletList(playerBullets);
	mWeapon->SetFiring(false);

	/*if (static_cast<int>(players->size()) > 0)
	{
		mWeapon->SetTarget((*players)[0]);
	}*/

	SetHealth(25);
	SetRadius(kRadius);
	SetValue(50);
	SetSpeed(30.0f);
	mStateTimer = 0.0f;
	mState = State::Enter;
}
开发者ID:UCLanGroup,项目名称:GameProject,代码行数:27,代码来源:CCruiser.cpp


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