5 static const int COLORS_PP_PRIORITY = 5;
8 private static float s_fSaturation = 1;
9 protected const string DESATURATION_EMAT =
"{7C202A913EB8B1A9}UI/Materials/ScreenEffects_ColorPP.emat";
11 [
Attribute( defvalue:
"0.5", uiwidget: UIWidgets.EditBox)]
12 protected float m_fDesaturationStart;
14 [
Attribute( defvalue:
"0.333", uiwidget: UIWidgets.EditBox)]
15 protected float m_fDesaturationEnd;
18 private static bool s_bEnableSaturation;
21 protected ChimeraCharacter m_pCharacterEntity;
24 protected bool m_bLocalPlayerOutsideCharacter;
27 override void DisplayStartDraw(IEntity owner)
29 m_pCharacterEntity = ChimeraCharacter.Cast(owner);
33 override void SettingsChanged()
35 if (!m_pCharacterEntity)
38 m_pCharacterEntity.GetWorld().SetCameraPostProcessEffect(m_pCharacterEntity.GetWorld().GetCurrentCameraId(), COLORS_PP_PRIORITY, PostProcessEffectType.Colors, DESATURATION_EMAT);
42 override void DisplayControlledEntityChanged(IEntity from, IEntity to)
46 m_pCharacterEntity = ChimeraCharacter.Cast(to);
47 if (!m_pCharacterEntity)
51 if (!m_pDamageManager)
57 m_pCharacterEntity.GetWorld().SetCameraPostProcessEffect(m_pCharacterEntity.GetWorld().GetCurrentCameraId(), COLORS_PP_PRIORITY, PostProcessEffectType.Colors, DESATURATION_EMAT);
61 protected override void DisplayOnSuspended()
63 s_bEnableSaturation =
false;
67 protected override void DisplayOnResumed()
69 s_bEnableSaturation =
true;
73 override void UpdateEffect(
float timeSlice)
75 AddDesaturationEffect();
79 void AddDesaturationEffect()
84 float bloodLevel = Math.InverseLerp(m_fDesaturationEnd, m_fDesaturationStart, m_pBloodHZ.GetHealthScaled());
86 s_fSaturation = Math.Clamp(bloodLevel, 0, 1);
87 s_bEnableSaturation = s_fSaturation < 1;
91 protected override void ClearEffects()