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
void play();
private:
float soundVolume;
std::string soundId;
bool playOnRemove;
bool looped;
Reflection::ReflectionProperty<float> soundVolume;
Reflection::ReflectionProperty<std::string> soundId;
Reflection::ReflectionProperty<bool> playOnRemove;
Reflection::ReflectionProperty<bool> looped;
};
}

View File

@@ -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<float>("SoundVolume", 0.5F, TYPE_FLOAT, this->dataTable);
soundId = Reflection::ReflectionProperty<std::string>("SoundID", "", TYPE_STRING, this->dataTable);
playOnRemove = Reflection::ReflectionProperty<bool>("PlayOnRemove", false, TYPE_BOOLEAN, this->dataTable);
looped = Reflection::ReflectionProperty<bool>("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