door sound triggers
This commit is contained in:
parent
064087f161
commit
a63a938a93
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -9,11 +9,6 @@ URotatingActor::URotatingActor()
|
|||
void URotatingActor::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
AudioComponent = GetOwner()->FindComponentByClass<UAudioComponent>();
|
||||
if (!AudioComponent)
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("No audio component found on: %s !"), *GetOwner()->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
void URotatingActor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||
|
@ -42,10 +37,11 @@ void URotatingActor::Rotate(const FRotator TargetRotation)
|
|||
{
|
||||
tempRotation = (TargetRotation.Yaw < 0) ? 1.f : -1.f;
|
||||
}
|
||||
|
||||
if(AudioComponent != nullptr && !soundHasBeenPlayed)
|
||||
|
||||
UAudioComponent * Audio = GetOwner()->FindComponentByClass<UAudioComponent>();
|
||||
if(Audio != nullptr && !soundHasBeenPlayed)
|
||||
{
|
||||
AudioComponent->Play();
|
||||
Audio->Play();
|
||||
soundHasBeenPlayed = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,6 @@ public:
|
|||
UPROPERTY(EditAnywhere)
|
||||
float TargetAngle = 90.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
UAudioComponent * AudioComponent;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
float RotationSpeed = 15.f;
|
||||
|
||||
|
|
Loading…
Reference in New Issue