本文整理汇总了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();
}
示例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
}
示例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;
}
示例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 );
}
示例5: SetHealth
void CASW_Parasite::SetHealthByDifficultyLevel()
{
if (FClassnameIs(this, "asw_parasite_defanged"))
{
SetHealth(ASWGameRules()->ModifyAlienHealthBySkillLevel(10));
}
else
{
SetHealth(ASWGameRules()->ModifyAlienHealthBySkillLevel(30));
}
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}