void UDecalComponent::LifeSpanCallback()
{
	DestroyComponent();

	auto* Owner = GetOwner();

	if (bDestroyOwnerAfterFade && Owner && (FadeDuration > 0.0f || FadeStartDelay > 0.0f))
	{
		Owner->Destroy();
	}
}
Ejemplo n.º 2
0
void UActorComponent::K2_DestroyComponent(UObject* Object)
{
	AActor* Owner = GetOwner();
	if (Owner == NULL || Owner == Object)
	{
		DestroyComponent();
	}
	else
	{
		// TODO: Put in Message Log
		UE_LOG(LogActorComponent, Error, TEXT("May not destroy component %s owned by %s."), *GetFullName(), *Owner->GetFullName());
	}
}
Ejemplo n.º 3
0
void UAudioComponent::PlaybackCompleted(bool bFailedToStart)
{
	// Mark inactive before calling destroy to avoid recursion
	bIsActive = false;

	if (!bFailedToStart && GetWorld() != nullptr && (OnAudioFinished.IsBound() || OnAudioFinishedNative.IsBound()))
	{
		INC_DWORD_STAT( STAT_AudioFinishedDelegatesCalled );
		SCOPE_CYCLE_COUNTER( STAT_AudioFinishedDelegates );

		OnAudioFinished.Broadcast();
		OnAudioFinishedNative.Broadcast(this);
	}

	// Auto destruction is handled via marking object for deletion.
	if (bAutoDestroy)
	{
		DestroyComponent();
	}
}
Ejemplo n.º 4
0
void UFMODAudioComponent::OnPlaybackCompleted()
{
	// Mark inactive before calling destroy to avoid recursion
	UE_LOG(LogFMOD, Verbose, TEXT("UFMODAudioComponent %p PlaybackCompleted"), this);
	bIsActive = false;
	SetComponentTickEnabled(false);

	OnEventStopped.Broadcast();

	if (StudioInstance)
	{
		StudioInstance->setCallback(nullptr);
		StudioInstance->release();
		StudioInstance = nullptr;
	}

	// Auto destruction is handled via marking object for deletion.
	if (bAutoDestroy)
	{
		DestroyComponent();
	}
}