コード例 #1
0
void ASBombActor::OnRep_Exploded()
{
	if (bExploded)
	{
		SimulateExplosion();
	}
}
コード例 #2
0
void ASBombActor::OnExplode()
{
	if (bExploded)
		return;

	// Notify the clients to simulate the explosion
	bExploded = true;
	
	// Run on server side (OnExplode is executed on the server) too
	SimulateExplosion();

	// Apply damage to player, enemies and environmental objects
	TArray<AActor*> IgnoreActors;
	UGameplayStatics::ApplyRadialDamage(this, ExplosionDamage, GetActorLocation(), ExplosionRadius, DamageType, IgnoreActors, this, nullptr);

	// TODO: Apply radial impulse to supporting objects
}
コード例 #3
0
void ASBombActor::OnExplode()
{
	if (bExploded)
	{
		return;
	}

	bExploded = true;
	// Runs on all clients (NetMulticast)
	SimulateExplosion();

	// Apply damage to player, enemies and environmental objects
	TArray<AActor*> IgnoreActors;
	UGameplayStatics::ApplyRadialDamage(this, ExplosionDamage, GetActorLocation(), ExplosionRadius, DamageType, IgnoreActors, this, nullptr);

	DrawDebugSphere(GetWorld(), GetActorLocation(), ExplosionRadius, 32, FColor::Red, false, 1.5f);
}
コード例 #4
0
void ASBombActor::OnExplode()
{
	if (bExploded)
		return;

	// Notify the clients to simulate the explosion
	bExploded = true;
	
	// Run on server side
	SimulateExplosion();

	// Apply damage to player, enemies and environmental objects
	TArray<AActor*> IgnoreActors;
	UGameplayStatics::ApplyRadialDamage(this, ExplosionDamage, GetActorLocation(), ExplosionRadius, DamageType, IgnoreActors, this, NULL);

	// TODO: Deal Damage to objects that support it
	// TODO: Apply radial impulse to supporting objects
	// TODO: Prepare to destroy self
}