particletest.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Particle test for Maxman
  2. class ParticleTest extends ItemBase
  3. {
  4. protected int PARTICLE_PATH;
  5. protected Particle m_Particle;
  6. // Constructor
  7. void ParticleTest()
  8. {
  9. if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() ) // Client side
  10. {
  11. string path = ParticleList.GetPathToParticles();
  12. // Enter particle ID to play when ParticleTest spawns
  13. PARTICLE_PATH = ParticleList.DEBUG_DOT;
  14. // Alternatively, uncomment the second line and enter particle filename without *.ptc suffix instead. Example: "menu_engine_fire"
  15. string particle_filename = "menu_engine_fire";
  16. //PARTICLE_PATH = ParticleList.GetParticleID( path + particle_filename );
  17. m_Particle = ParticleManager.GetInstance().PlayOnObject( PARTICLE_PATH, this, GetPosition());
  18. }
  19. }
  20. // Destructor
  21. override void EEDelete(EntityAI parent)
  22. {
  23. super.EEDelete(parent);
  24. if (m_Particle && GetGame()) // GetGame() is null when the game is being shut down
  25. {
  26. m_Particle.Stop();
  27. GetGame().ObjectDelete(m_Particle);
  28. }
  29. }
  30. }