buoylight.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. class BuoyLight extends PointLightBase
  2. {
  3. const string LIGHT_MAT_ON = "DZ\\structures_sakhal\\industrial\\harbour\\data\\Buoy_01_glass_e.rvmat";
  4. protected const string LIGHT_MAT_OFF = "DZ\\structures_sakhal\\industrial\\harbour\\data\\Buoy_01_glass.rvmat";
  5. protected const int BASE_BRIGTHNESS = 5;
  6. protected bool m_IsOn;
  7. void BuoyLight()
  8. {
  9. SetBrightnessTo(BASE_BRIGTHNESS);
  10. SetRadiusTo(15);
  11. SetCastShadow(true);
  12. SetVisibleDuringDaylight(false);
  13. SetFlareVisible(false);
  14. SetAmbientColor(1.0, 0.2, 0.2);
  15. SetDiffuseColor(1.0, 0.2, 0.2);
  16. DimmingConfig dimCfg = new DimmingConfig();
  17. dimCfg.AddDimmingPattern({0}, {0.01}, {3}, {0.01}, {1});
  18. dimCfg.SetPatternQueueRepeat(-1);
  19. EnableDimming(BASE_BRIGTHNESS, dimCfg);
  20. }
  21. override void EOnFrame(IEntity other, float timeSlice)
  22. {
  23. if (!m_LightDimming)
  24. return;
  25. if (!m_IsOn && m_LightDimming.GetState() == ELightDimmingState.DIMMING)
  26. {
  27. m_IsOn = true;
  28. UpdateLightSourceMaterial(LIGHT_MAT_OFF);
  29. }
  30. else if (m_IsOn && m_LightDimming.GetState() == ELightDimmingState.BRIGHTENING)
  31. {
  32. m_IsOn = false;
  33. UpdateLightSourceMaterial(LIGHT_MAT_ON);
  34. }
  35. }
  36. }
  37. class MooringBuoyLight extends PointLightBase
  38. {
  39. const string LIGHT_MAT_ON = "DZ\\structures_sakhal\\industrial\\harbour\\data\\Mooring_Buoy_Glass_e.rvmat";
  40. void MooringBuoyLight()
  41. {
  42. SetBrightnessTo(5);
  43. SetRadiusTo(10);
  44. SetCastShadow(false);
  45. SetVisibleDuringDaylight(false);
  46. SetAmbientColor(1.0, 0.2, 0.2);
  47. SetDiffuseColor(1.0, 0.2, 0.2);
  48. }
  49. }