pistollightlight.c 1012 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. class PistollightLight extends SpotLightBase
  2. {
  3. private static float m_DefaultBrightness = 5.25;
  4. private static float m_DefaultRadius = 18;
  5. private static float m_DefaultAngle = 100;
  6. void PistollightLight()
  7. {
  8. SetVisibleDuringDaylight( true );
  9. SetRadiusTo( m_DefaultRadius );
  10. SetSpotLightAngle( m_DefaultAngle );
  11. SetCastShadow( true );
  12. SetBrightnessTo( m_DefaultBrightness );
  13. SetFadeOutTime( 0.05 );
  14. SetAmbientColor( 0.92, 0.88, 0.82 );
  15. SetDiffuseColor( 0.92, 0.88, 0.82 );
  16. SetDisableShadowsWithinRadius( 1.2 );
  17. }
  18. void SetIntensity( float coef, float time )
  19. {
  20. FadeBrightnessTo( m_DefaultBrightness * coef, time );
  21. FadeRadiusTo( m_DefaultRadius * coef, time );
  22. }
  23. override void UpdateLightMode( string slotName )
  24. {
  25. switch ( slotName )
  26. {
  27. case "weaponFlashlight":
  28. SetSpotLightAngle( m_DefaultAngle/2 );
  29. SetRadiusTo( m_DefaultRadius * 1.8 );
  30. break;
  31. default:
  32. SetSpotLightAngle( m_DefaultAngle );
  33. SetRadiusTo( m_DefaultRadius );
  34. break;
  35. }
  36. }
  37. }