From 8726e1e3e3715ecb4ac1cbe8dd86aff8fd9f5d79 Mon Sep 17 00:00:00 2001 From: Vulpovile Date: Mon, 6 Nov 2023 18:44:42 -0800 Subject: [PATCH] Enable soundservice in datamodelinstance --- src/include/DataModelV3/SoundInstance.h | 8 ++++---- src/source/DataModelV3/SoundInstance.cpp | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/include/DataModelV3/SoundInstance.h b/src/include/DataModelV3/SoundInstance.h index 9b9c7cd..e4eb6d1 100644 --- a/src/include/DataModelV3/SoundInstance.h +++ b/src/include/DataModelV3/SoundInstance.h @@ -22,9 +22,9 @@ namespace B3D{ // Functions void play(); private: - float soundVolume; - std::string soundId; - bool playOnRemove; - bool looped; + Reflection::ReflectionProperty soundVolume; + Reflection::ReflectionProperty soundId; + Reflection::ReflectionProperty playOnRemove; + Reflection::ReflectionProperty looped; }; } \ No newline at end of file diff --git a/src/source/DataModelV3/SoundInstance.cpp b/src/source/DataModelV3/SoundInstance.cpp index 4187fd8..d78f42d 100644 --- a/src/source/DataModelV3/SoundInstance.cpp +++ b/src/source/DataModelV3/SoundInstance.cpp @@ -2,15 +2,16 @@ #include "DataModelV3/DataModelInstance.h" using namespace B3D; +using namespace Reflection; SoundInstance::SoundInstance() { + Instance::Instance("Sound"); name = "Sound"; - - soundVolume = 0.5; - soundId = ""; - playOnRemove = false; - looped = false; + soundVolume = Reflection::ReflectionProperty("SoundVolume", 0.5F, TYPE_FLOAT, this->dataTable); + soundId = Reflection::ReflectionProperty("SoundID", "", TYPE_STRING, this->dataTable); + playOnRemove = Reflection::ReflectionProperty("PlayOnRemove", false, TYPE_BOOLEAN, this->dataTable); + looped = Reflection::ReflectionProperty("Looped", false, TYPE_BOOLEAN, this->dataTable); } SoundInstance::~SoundInstance(void) @@ -28,22 +29,22 @@ void SoundInstance::play() // Getters float SoundInstance::getSoundVolume() { - return soundVolume; + return soundVolume.getValue(); } bool SoundInstance::isPlayedOnRemove() { - return playOnRemove; + return playOnRemove.getValue(); } std::string SoundInstance::getSoundId() { - return soundId; + return soundId.getValue(); } bool SoundInstance::isLooped() { - return looped; + return looped.getValue(); } // Setters