soundEmitterObject.cpp 670 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "SoundEmitterObject.h"
  2. IMPLEMENT_CO_NETOBJECT_V1(SoundEmitterObject);
  3. SoundEmitterObject::SoundEmitterObject()
  4. : mSoundComponent(nullptr)
  5. {
  6. }
  7. SoundEmitterObject::~SoundEmitterObject()
  8. {
  9. }
  10. bool SoundEmitterObject::onAdd()
  11. {
  12. if (!Parent::onAdd())
  13. return false;
  14. //Sound
  15. mSoundComponent = new SoundComponent();
  16. if (!mSoundComponent->registerObject())
  17. {
  18. Con::errorf("SoundEmitterObject::onAdd - unable to add soundComponent!");
  19. return false;
  20. }
  21. mSoundComponent->setInternalName("soundComponent");
  22. addComponent(mSoundComponent);
  23. return true;
  24. }
  25. void SoundEmitterObject::onRemove()
  26. {
  27. Parent::onRemove();
  28. }