anniversaryspotlight.c 808 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. class AnniversarySpotLight : Building
  2. {
  3. #ifndef SERVER
  4. protected AnniversaryMainLight m_Light;
  5. #endif
  6. protected bool m_LightState;
  7. void AnniversarySpotLight()
  8. {
  9. RegisterNetSyncVariableBool("m_LightState");
  10. }
  11. override void OnVariablesSynchronized()
  12. {
  13. super.OnVariablesSynchronized();
  14. #ifndef SERVER
  15. if (m_LightState)
  16. {
  17. m_Light = AnniversaryMainLight.Cast(ScriptedLightBase.CreateLight(AnniversaryMainLight, GetPosition()));
  18. }
  19. else
  20. {
  21. if (m_Light)
  22. m_Light.FadeOut(0.5);
  23. }
  24. #endif
  25. }
  26. override void EEDelete(EntityAI parent)
  27. {
  28. super.EEDelete(parent);
  29. #ifndef SERVER
  30. if (m_Light)
  31. m_Light.Destroy();
  32. #endif
  33. }
  34. void DeActivate()
  35. {
  36. m_LightState = false;
  37. SetSynchDirty();
  38. }
  39. void Activate()
  40. {
  41. m_LightState = true;
  42. SetSynchDirty();
  43. }
  44. }