4 protected const float DEATHEFFECT_START_OPACITY = 0.7;
5 protected const float DEATHEFFECT_FADEIN_OPACITY_DURATION = 0.8;
6 protected const float DEATHEFFECT_FADEIN_PROGRESSION_DURACTION = 0.5;
7 protected const float DEATHEFFECT_FADEIN_OPACITY_TARGET = 1;
8 protected const float DEATHEFFECT_FADEIN_PROGRESSION_TARGET = 1;
11 protected const float INSTADEATHEFFECT_START_OPACITY = 0.4;
12 protected const float INSTADEATHEFFECT_START_PROGRESSION = 0.4;
13 protected const float INSTADEATHEFFECT_FADEIN_OPACITY_DURATION = 8.5;
14 protected const float INSTADEATHEFFECT_FADEIN_PROGRESSION_DURACTION = 10;
15 protected const float INSTADEATHEFFECT_FADEIN_OPACITY_TARGET = 1;
16 protected const float INSTADEATHEFFECT_FADEIN_PROGRESSION_TARGET = 1;
19 protected ImageWidget m_wDeath;
20 protected ImageWidget m_wBlackOut;
23 protected ChimeraCharacter m_pCharacterEntity;
29 override void DisplayStartDraw(IEntity owner)
31 m_pCharacterEntity = ChimeraCharacter.Cast(owner);
33 m_wDeath = ImageWidget.Cast(
m_wRoot.FindAnyWidget(
"DeathOverlay"));
34 m_wBlackOut = ImageWidget.Cast(
m_wRoot.FindAnyWidget(
"BlackOut"));
38 override void DisplayControlledEntityChanged(IEntity from, IEntity to)
43 m_pCharacterEntity = ChimeraCharacter.Cast(to);
44 if (!m_pCharacterEntity)
51 if (!m_pDamageManager)
55 m_pHeadHitZone =
SCR_HitZone.Cast(m_pDamageManager.GetHeadHitZone());
58 m_pHeadHitZone.GetOnDamageStateChanged().Insert(InstaDeathEffect);
60 m_pDamageManager.GetOnDamageStateChanged().Insert(OnDamageStateChanged);
64 private void OnDamageStateChanged()
66 if (m_pDamageManager.GetState() !=
EDamageState.DESTROYED)
69 if (m_pHeadHitZone.GetDamageState() !=
EDamageState.DESTROYED)
81 AnimateWidget.StopAllAnimations(m_wDeath);
82 AnimateWidget.Opacity(m_wDeath, DEATHEFFECT_FADEIN_OPACITY_TARGET, DEATHEFFECT_FADEIN_OPACITY_DURATION);
83 AnimateWidget.AlphaMask(m_wDeath, DEATHEFFECT_FADEIN_PROGRESSION_TARGET, DEATHEFFECT_FADEIN_PROGRESSION_DURACTION);
87 void InstaDeathEffect()
89 if (m_wDeath.GetOpacity() >= 0.99 )
92 if (m_pHeadHitZone.GetDamageState() !=
EDamageState.DESTROYED)
95 if (m_pDamageManager.GetState() !=
EDamageState.DESTROYED)
98 AnimateWidget.StopAllAnimations(m_wDeath);
99 AnimateWidget.Opacity(m_wDeath, INSTADEATHEFFECT_FADEIN_OPACITY_TARGET, INSTADEATHEFFECT_FADEIN_OPACITY_DURATION);
100 AnimateWidget.AlphaMask(m_wDeath, INSTADEATHEFFECT_FADEIN_PROGRESSION_TARGET, INSTADEATHEFFECT_FADEIN_PROGRESSION_DURACTION);
104 protected override void ClearEffects()
106 if (m_pDamageManager)
107 m_pDamageManager.GetOnDamageStateChanged().Remove(OnDamageStateChanged);
110 m_pHeadHitZone.GetOnDamageStateChanged().Remove(InstaDeathEffect);
114 AnimateWidget.StopAllAnimations(m_wDeath);
115 m_wDeath.SetOpacity(0);
116 m_wDeath.SetMaskProgress(0);