Enable soundservice in datamodelinstance

This commit is contained in:
Vulpovile
2023-11-06 18:44:42 -08:00
parent d8a2fe7495
commit 8726e1e3e3
2 changed files with 14 additions and 13 deletions

View File

@@ -22,9 +22,9 @@ namespace B3D{
// Functions // Functions
void play(); void play();
private: private:
float soundVolume; Reflection::ReflectionProperty<float> soundVolume;
std::string soundId; Reflection::ReflectionProperty<std::string> soundId;
bool playOnRemove; Reflection::ReflectionProperty<bool> playOnRemove;
bool looped; Reflection::ReflectionProperty<bool> looped;
}; };
} }

View File

@@ -2,15 +2,16 @@
#include "DataModelV3/DataModelInstance.h" #include "DataModelV3/DataModelInstance.h"
using namespace B3D; using namespace B3D;
using namespace Reflection;
SoundInstance::SoundInstance() SoundInstance::SoundInstance()
{ {
Instance::Instance("Sound");
name = "Sound"; name = "Sound";
soundVolume = Reflection::ReflectionProperty<float>("SoundVolume", 0.5F, TYPE_FLOAT, this->dataTable);
soundVolume = 0.5; soundId = Reflection::ReflectionProperty<std::string>("SoundID", "", TYPE_STRING, this->dataTable);
soundId = ""; playOnRemove = Reflection::ReflectionProperty<bool>("PlayOnRemove", false, TYPE_BOOLEAN, this->dataTable);
playOnRemove = false; looped = Reflection::ReflectionProperty<bool>("Looped", false, TYPE_BOOLEAN, this->dataTable);
looped = false;
} }
SoundInstance::~SoundInstance(void) SoundInstance::~SoundInstance(void)
@@ -28,22 +29,22 @@ void SoundInstance::play()
// Getters // Getters
float SoundInstance::getSoundVolume() float SoundInstance::getSoundVolume()
{ {
return soundVolume; return soundVolume.getValue();
} }
bool SoundInstance::isPlayedOnRemove() bool SoundInstance::isPlayedOnRemove()
{ {
return playOnRemove; return playOnRemove.getValue();
} }
std::string SoundInstance::getSoundId() std::string SoundInstance::getSoundId()
{ {
return soundId; return soundId.getValue();
} }
bool SoundInstance::isLooped() bool SoundInstance::isLooped()
{ {
return looped; return looped.getValue();
} }
// Setters // Setters