soundevents.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. class SoundEventBase
  2. {
  3. AbstractWave m_SoundSetCallback;
  4. int m_Type;
  5. int m_ID;
  6. int m_SoundVoiceAnimEventClassID;
  7. bool m_RequestDestroy;
  8. string m_SoundSetNameRoot;
  9. bool m_SkipForControlledCharacter;
  10. int m_Param;
  11. void ~SoundEventBase()
  12. {
  13. if(m_SoundSetCallback) m_SoundSetCallback.Stop();
  14. }
  15. //obsolete function, now possible to set a param
  16. bool IsSkipForControlled()
  17. {
  18. return m_SkipForControlledCharacter;
  19. }
  20. void Tick()
  21. {
  22. if(!m_SoundSetCallback)
  23. {
  24. m_RequestDestroy = true;
  25. }
  26. }
  27. bool IsSoundCallbackExist()
  28. {
  29. if( m_SoundSetCallback )
  30. {
  31. return true;
  32. }
  33. return false;
  34. }
  35. bool IsDestroyRequested()
  36. {
  37. return m_RequestDestroy;
  38. }
  39. bool CanPlay()
  40. {
  41. return true;
  42. }
  43. bool Play()
  44. {
  45. return true;
  46. }
  47. void OnPlay(PlayerBase player);
  48. void Stop()
  49. {
  50. if(m_SoundSetCallback)
  51. {
  52. m_SoundSetCallback.Stop();
  53. }
  54. }
  55. int GetSoundEventID()
  56. {
  57. return m_ID;
  58. }
  59. int GetSoundEventType()
  60. {
  61. return m_Type;
  62. }
  63. AbstractWave GetSoundSetCallback()
  64. {
  65. return m_SoundSetCallback;
  66. }
  67. }
  68. class SoundEventHandler
  69. {
  70. static int GetSoundEventType(int id) { return -1; }
  71. //void OnTick(float delta_time) {}
  72. bool PlayRequest(EPlayerSoundEventID id, bool sent_from_server = false) { return true; }
  73. bool PlayRequestEx(EPlayerSoundEventID id, bool sent_from_server = false, int param = 0){ return true; };
  74. int GetCurrentStateEventID() { return -1; }
  75. int GetCurrentStateEventType() { return -1; }
  76. }