5 static const int CHROM_ABER_PRIORITY = 9;
7 [
Attribute( defvalue:
"6", uiwidget: UIWidgets.EditBox,
desc:
"Duration of the regeneration effect in seconds" )]
8 protected float m_fRegenEffectDuration;
10 [
Attribute(
"0 0 1 1", UIWidgets.GraphDialog,
desc:
"Trajectory of the intensity of the regenerationEffect")]
11 protected ref Curve m_Curve;
14 protected ChimeraCharacter m_pCharacterEntity;
16 protected const string CHROMATIC_ABERIATION_EMAT =
"{A78A424C3179C706}UI/Materials/ScreenEffects_ChromAberrPP.emat";
17 protected bool m_bRegenerationEffect;
18 protected float m_fRegenEffectTimeRemaining;
21 private static bool s_bEnabled;
22 private static float s_fChromAberPower;
26 override void DisplayStartDraw(IEntity owner)
28 m_pCharacterEntity = ChimeraCharacter.Cast(owner);
32 override void DisplayControlledEntityChanged(IEntity from, IEntity to)
36 m_pCharacterEntity = ChimeraCharacter.Cast(to);
37 if (!m_pCharacterEntity)
41 if (!m_pDamageManager)
44 m_pDamageManager.GetOnDamageOverTimeAdded().Insert(OnDamageOverTimeAdded);
46 m_pCharacterEntity.GetWorld().SetCameraPostProcessEffect(m_pCharacterEntity.GetWorld().GetCurrentCameraId(), CHROM_ABER_PRIORITY, PostProcessEffectType.ChromAber, CHROMATIC_ABERIATION_EMAT);
50 override protected void DisplayOnSuspended()
56 override protected void DisplayOnResumed()
62 override void UpdateEffect(
float timeSlice)
64 if (m_bRegenerationEffect)
65 RegenerationEffect(timeSlice);
69 protected void RegenerationEffect(
float timeSlice)
71 m_fRegenEffectTimeRemaining -= timeSlice;
73 float chromAberProgress = Math.InverseLerp(m_fRegenEffectDuration, 0, m_fRegenEffectTimeRemaining);
75 vector chromAberPowerScaled = Math3D.Curve(ECurveType.CatmullRom, chromAberProgress, m_Curve);
78 s_fChromAberPower = Math.Lerp(0, 0.05, chromAberPowerScaled[1]);
80 if (m_fRegenEffectTimeRemaining <= 0)
82 m_bRegenerationEffect =
false;
83 m_fRegenEffectTimeRemaining = 0;
84 s_fChromAberPower = 0;
94 m_fRegenEffectTimeRemaining = m_fRegenEffectDuration;
95 m_bRegenerationEffect =
true;
99 protected override void ClearEffects()
101 m_fRegenEffectTimeRemaining = 0;
102 s_fChromAberPower = 0;
104 if (m_pDamageManager)
105 m_pDamageManager.GetOnDamageOverTimeAdded().Remove(OnDamageOverTimeAdded);