Example #1
0
void CViewThread::Clear()
{
	m_nDeaths = 0;
	m_nAmmo = 0;
	m_nFrags = 0;
	m_nHealth = 0;
	m_vBotPos.Clear();
	m_vBotVelocity.Clear();
	m_strAttackName = _T("None");
	m_pAttackTarget = NULL;
	m_vAttackDist.Clear();
	m_vAttackPos.Clear();
	m_strMoveName = _T("None");
	m_pMoveTarget = NULL;
	m_vMoveDist.Clear();
	m_vMovePos.Clear();
	UpdateAmmoAndWeapon();
	UpdateAttackDist();
	UpdateAttackName();
	UpdateAttackPos();
	UpdateBotOrigin();
	UpdateBotVelocity();
	UpdateDeathsAndFrags();
	UpdateHealth();
	UpdateMoveDist();
	UpdateMoveName();
	UpdateMovePos();
}
Example #2
0
void CViewThread::OnBotUpdateHealth( const short nHealth )
{
	if ( UpdateOkay() )
	{
		m_nHealth = nHealth;
		UpdateHealth();
	}
}
Example #3
0
void CPlayerStats::Clear()
{
    UpdateHealth (0);
    UpdateArmor (0);
    for (uint8 i = 0; i < GUN_MAX_NUMBER; i++)
    {
        UpdateAmmo (i, 0);
    }
}
Example #4
0
void CInterfaceUnit::OnLoop()
{
    CInterface::OnLoop();

	CleanUpTargetSurf();
    CleanUpHealthBar();

    UpdateUnit();

	UpdateTarget();

    UpdateHealth();
}
Example #5
0
void CRateOfDeathHelper_Target::Update( const float elapsedTimeSeconds, const CRateOfDeathHelper_AttackerInfo& attacker )
{
	if ( m_pTargetActor == NULL )
	{
		return;
	}

	UpdateStance();
	UpdateIsInVehicle();
	UpdateZone( attacker );
	UpdateStayAliveTime( attacker );
	UpdateHealth( elapsedTimeSeconds );
}
Example #6
0
void CUIHudStatesWnd::Update()
{
	CActor* actor = smart_cast<CActor*>( Level().CurrentViewEntity() );
	if ( !actor )
	{
		return;
	}

	UpdateHealth( actor );
	UpdateActiveItemInfo( actor );
	UpdateIndicators( actor );
	
	UpdateZones();

	inherited::Update();
}
Example #7
0
//-----------------------------------------------------------------------------
// Purpose: Allows us to make damage exceptions that are breakable-specific.
//-----------------------------------------------------------------------------
int CBreakable::OnTakeDamage( const CTakeDamageInfo &info )
{
	Vector	vecTemp;

	CTakeDamageInfo subInfo = info;

	// If attacker can't do at least the min required damage to us, don't take any damage from them
	if ( m_takedamage == DAMAGE_NO || info.GetDamage() < m_iMinHealthDmg )
		return 0;

	// Check our damage filter
	if ( !PassesDamageFilter(subInfo) )
	{
		m_bTookPhysicsDamage = false;
		return 1;
	}

	vecTemp = subInfo.GetInflictor()->GetAbsOrigin() - WorldSpaceCenter();

	if (!IsBreakable())
		return 0;

	float flPropDamage = GetBreakableDamage( subInfo, assert_cast<IBreakableWithPropData*>(this) );
	subInfo.SetDamage( flPropDamage );
	
	int iPrevHealth = m_iHealth;
	BaseClass::OnTakeDamage( subInfo );

	// HACK: slam health back to what it was so UpdateHealth can do its thing
	int iNewHealth = m_iHealth;
	m_iHealth = iPrevHealth;
	if ( !UpdateHealth( iNewHealth, info.GetAttacker() ) )
		return 1;

	// Make a shard noise each time func breakable is hit, if it's capable of taking damage
	if ( m_takedamage == DAMAGE_YES )
	{
		// Don't play shard noise if being burned.
		// Don't play shard noise if cbreakable actually died.
		if ( ( subInfo.GetDamageType() & DMG_BURN ) == false )
		{
			DamageSound();
		}
	}

	return 1;
}
Example #8
0
ActorLifebar::ActorLifebar() : Sprite()
{
	Health = 50; // Out of 100!
	pending_health = 0;
	time = 0;

	SetImage(GameState::GetInstance().GetSkinImage("healthbar.png"));

	SetWidth(PlayfieldHeight / 2);
	SetHeight(Configuration::GetSkinConfigf("Height", "Lifebar" ));
	Centered = Configuration::GetSkinConfigf( "Centered", "Lifebar" ) != 0;
	SetPosition( Configuration::GetSkinConfigf("X", "Lifebar" ), Configuration::GetSkinConfigf("Y", "Lifebar" ));
	SetRotation( Configuration::GetSkinConfigf("Rotation", "Lifebar" ) );
	AffectedByLightning = true;

	UpdateHealth();
}
void AMMO_Character::TakeDamageFromEnemy(int32 Damage, AActor* Monster)
{
	FRotator Rot = Player_SkeletalMeshComponent->GetSocketRotation(TEXT("Head"));
	Rot = FRotator(0, Rot.Yaw, 0);
	Rot += FRotator(0, 90, 0);

	FVector ForwardVector =  (Rot.Vector() * 500);
	FVector DirToGobo = Monster->GetActorLocation() - GetActorLocation();
	ForwardVector = FVector(ForwardVector.X, ForwardVector.Y, 0);
	DirToGobo = FVector(DirToGobo.X, DirToGobo.Y, 0);

	float DotProduct = FVector::DotProduct(ForwardVector.GetSafeNormal(), DirToGobo.GetSafeNormal());
	
	float Radians = FMath::RadiansToDegrees(acosf(DotProduct));

	if (Cast<AMMO_Mob_Character>(Monster))
	{
		Damage = Cast<AMMO_Mob_Character>(Monster)->Attack + FMath::RandRange(Cast<AMMO_Mob_Character>(Monster)->AttackBonusMin, Cast<AMMO_Mob_Character>(Monster)->AttackBonusMax);
		Multicast_PlaySound(GlobalPool->GenericSoundEffects.FindRef(ESoundEffectLibrary::SFX_DaggerHit), GetActorLocation());
	}
	else if(Cast<ABoss>(Monster))
	{
		Damage = Cast<ABoss>(Monster)->BaseDamage + FMath::RandRange(Cast<ABoss>(Monster)->BonusDamage_Min, Cast<ABoss>(Monster)->BonusDamage_Max);
		Multicast_PlaySound(GlobalPool->GenericSoundEffects.FindRef(ESoundEffectLibrary::SFX_BossHit), GetActorLocation());
	}

	Damage -= Damage*BaseDamageReduction;

	if (FMath::Abs(Radians) <= 55.f && bIsShieldBlocking)
	{
		Damage = FMath::DivideAndRoundDown(Damage, 3);
		Multicast_PlayAnimation(GetHurtMontageShield);
	}
	else
	{
		if (!(AnimInstance->Montage_IsPlaying(AttackMontage) || AnimInstance->Montage_IsPlaying(SecondAttackMontage)))
		{
			Multicast_PlayAnimation(GetHurtMontage);
		}
	}

	UpdateHealth(Damage);
}
Example #10
0
void ActorLifebar::Run(double delta)
{
	time += delta;
	if (pending_health != 0)
	{
		Health += pending_health * delta;
		pending_health -= pending_health * delta;

		if (pending_health > 200) // only up to 2x health
			pending_health = 200;

		/* Accomulate health. Better you do, more forviging to mistakes. */
		if (Health > 100)
		{
			pending_health += Health - 100;
			Health = 100;
		}
	}

	UpdateHealth();
}
Example #11
0
//-----------------------------------------------------------------------------
// Purpose: Input handler for setting the breakable's health.
//-----------------------------------------------------------------------------
void CBreakable::InputSetHealth( inputdata_t &inputdata )
{
	UpdateHealth( inputdata.value.Int(), inputdata.pActivator );
}
Example #12
0
//-----------------------------------------------------------------------------
// Purpose: Input handler for removing health from the breakable.
// Input  : Integer health points to remove.
//-----------------------------------------------------------------------------
void CBreakable::InputRemoveHealth( inputdata_t &inputdata )
{
	UpdateHealth( m_iHealth - inputdata.value.Int(), inputdata.pActivator );
}