dynamicarea_flare.c 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // The dummy entity which is spawned in the announcement process of Dynamic Contaminated Areas
  2. class DynamicArea_Flare : ScriptedEntity
  3. {
  4. const float FALL_SPEED = 0.5; // The speed at which this object falls ( units per second )
  5. const float LIFETIME = 40000; // How long this entity will stay in world
  6. private Particle m_Particle;
  7. void DynamicArea_Flare()
  8. {
  9. SetEventMask( EntityEvent.FRAME );
  10. SetFlags( EntityFlags.ACTIVE, false );
  11. // We create the particle effect
  12. m_Particle = ParticleManager.GetInstance().PlayOnObject( ParticleList.FLAREPROJ_ACTIVATE_RED, this );
  13. // We specify we will delete this object after set time
  14. GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater( GetGame().ObjectDeleteOnClient, LIFETIME, false, this );
  15. }
  16. // We slowly fall
  17. override void EOnFrame( IEntity other, float timeSlice )
  18. {
  19. vector newPos = GetPosition();
  20. newPos[1] = newPos[1] - ( FALL_SPEED * timeSlice );
  21. SetPosition( newPos );
  22. }
  23. // We delete the entity and stop the particles
  24. override void EEDelete( EntityAI parent )
  25. {
  26. if ( m_Particle )
  27. m_Particle.Stop();
  28. }
  29. }