diff --git a/Examples/LocationReceiver_Actor.uasset b/Examples/LocationReceiver_Actor.uasset new file mode 100644 index 0000000..9d402ba Binary files /dev/null and b/Examples/LocationReceiver_Actor.uasset differ diff --git a/OSC/Source/OSC/Private/Receive/OscReceiverActor.cpp b/OSC/Source/OSC/Private/Receive/OscReceiverActor.cpp new file mode 100644 index 0000000..2a12516 --- /dev/null +++ b/OSC/Source/OSC/Private/Receive/OscReceiverActor.cpp @@ -0,0 +1,25 @@ +#include "OscPrivatePCH.h" +#include "OscReceiverActor.h" +#include "OscDispatcher.h" + + +AOscReceiverActor::AOscReceiverActor(const class FPostConstructInitializeProperties& PCIP) + : Super(PCIP) +{ + auto instance = UOscDispatcher::Get(); + if (instance && !HasAnyFlags(RF_ClassDefaultObject)) + { + instance->RegisterReceiver(this); + } +} + +void AOscReceiverActor::BeginDestroy() +{ + auto instance = UOscDispatcher::Get(); + if (instance && !HasAnyFlags(RF_ClassDefaultObject)) + { + instance->UnregisterReceiver(this); + } + + Super::BeginDestroy(); +} diff --git a/OSC/Source/OSC/Private/Receive/OscReceiverActor.h b/OSC/Source/OSC/Private/Receive/OscReceiverActor.h new file mode 100644 index 0000000..4981d1c --- /dev/null +++ b/OSC/Source/OSC/Private/Receive/OscReceiverActor.h @@ -0,0 +1,33 @@ +#pragma once + +#include "GameFramework/Actor.h" +#include "OscReceiverInterface.h" +#include "OscDataStruct.h" +#include "OscReceiverActor.generated.h" + + +UCLASS() +class AOscReceiverActor : public AActor, public IOscReceiverInterface +{ + GENERATED_UCLASS_BODY() + + UPROPERTY(EditAnywhere, Category=OSC) + FString AddressFilter; + + UFUNCTION(BlueprintImplementableEvent, Category=OSC) + void OnOscReceived(const FName & Address, const FOscDataStruct & Data); + +protected: + + virtual void BeginDestroy() override; + + virtual const FString & GetAddressFilter() override + { + return AddressFilter; + } + + virtual void SendEvent(const FName & Address, const FOscDataStruct & Data) override + { + OnOscReceived(Address, Data); + } +}; diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8b3b9c2 --- /dev/null +++ b/VERSION @@ -0,0 +1,2 @@ +0.2: add receiver actor class +0.1: receiver component, send function, float integer boolean and string parameters