crashbase.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. class CrashBase extends House
  2. {
  3. Particle m_ParticleEfx;
  4. static bool m_Init = Init();
  5. static bool Init()
  6. {
  7. CrashSoundSets.RegisterSoundSet("HeliCrash_Distant_SoundSet");
  8. CrashSoundSets.RegisterSoundSet("SledgeCrash_Distant_SoundSet");
  9. return true;
  10. }
  11. override void EEOnCECreate()
  12. {
  13. super.EEOnCECreate();
  14. RequestSoundEvent();
  15. }
  16. void RequestSoundEvent()
  17. {
  18. Param3<bool, vector, int> playSound = new Param3<bool, vector, int>(true, GetPosition(), GetSoundSet().Hash());
  19. GetGame().RPCSingleParam( null, ERPCs.RPC_SOUND_HELICRASH, playSound, true );
  20. }
  21. // needs to have the soundset registered in CrashBase.Init()
  22. string GetSoundSet()
  23. {
  24. return "HeliCrash_Distant_SoundSet";
  25. }
  26. override void EEInit()
  27. {
  28. super.EEInit();
  29. //Setup for local sound tests
  30. #ifdef DEVELOPER
  31. if ( !GetGame().IsMultiplayer() )
  32. {
  33. EffectSound eff = SEffectManager.PlaySound( GetSoundSet(), GetPosition(), 0.1, 0.1 );
  34. eff.SetAutodestroy(true);
  35. }
  36. #endif
  37. }
  38. override void EEDelete(EntityAI parent)
  39. {
  40. if ( !GetGame().IsDedicatedServer() )
  41. {
  42. if ( m_ParticleEfx )
  43. m_ParticleEfx.Stop();
  44. }
  45. }
  46. };