Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_DeathScreenEffect.c
Go to the documentation of this file.
1
class
SCR_DeathScreenEffect
:
SCR_BaseScreenEffect
2
{
3
// Play Animation of DeathEffect()
4
protected
const
float
DEATHEFFECT_START_OPACITY
= 0.7;
5
protected
const
float
DEATHEFFECT_FADEIN_OPACITY_DURATION
= 8;
6
protected
const
float
DEATHEFFECT_FADEIN_PROGRESSION_DURACTION
= 5;
7
8
// Play Animation of InstaDeathEffect()
9
protected
const
float
INSTADEATHEFFECT_START_OPACITY
= 0.4;
10
protected
const
float
INSTADEATHEFFECT_START_PROGRESSION
= 0.4;
11
protected
const
float
INSTADEATHEFFECT_FADEIN_OPACITY_DURATION
= 8.5;
12
protected
const
float
INSTADEATHEFFECT_FADEIN_PROGRESSION_DURACTION
= 10;
13
14
protected
const
float
DEATHEFFECT_FADEIN_OPACITY_TARGET
= 1;
15
protected
const
float
DEATHEFFECT_FADEIN_PROGRESSION_TARGET
= 1;
16
17
// Widgets
18
protected
ImageWidget
m_wDeath
;
19
protected
ImageWidget
m_wBlackOut
;
20
21
// Character
22
protected
ChimeraCharacter
m_pCharacterEntity
;
23
protected
SCR_HitZone
m_pHeadHitZone
;
24
protected
SCR_CharacterDamageManagerComponent
m_pDamageManager
;
25
26
27
//------------------------------------------------------------------------------------------------
28
override
void
DisplayStartDraw
(
IEntity
owner)
29
{
30
m_pCharacterEntity
=
ChimeraCharacter
.Cast(owner);
31
32
m_wDeath
=
ImageWidget
.Cast(
m_wRoot
.FindAnyWidget(
"DeathOverlay"
));
33
m_wBlackOut
=
ImageWidget
.Cast(
m_wRoot
.FindAnyWidget(
"DeathBlackOut"
));
34
}
35
36
//------------------------------------------------------------------------------------------------
37
override
void
DisplayControlledEntityChanged
(
IEntity
from,
IEntity
to)
38
{
39
if
(!to)
40
return
;
41
42
m_pCharacterEntity
=
ChimeraCharacter
.Cast(to);
43
if
(!
m_pCharacterEntity
)
44
return
;
45
46
//Don't remove effects until new entity was aquired, so death effects persist through death
47
ClearEffects
();
48
49
m_pDamageManager
=
SCR_CharacterDamageManagerComponent
.Cast(
m_pCharacterEntity
.GetDamageManager());
50
if
(!
m_pDamageManager
)
51
return
;
52
53
// Invoker for momentary damage events and DOT damage events
54
m_pHeadHitZone
=
m_pDamageManager
.GetHeadHitZone();
55
56
if
(
m_pHeadHitZone
)
57
m_pHeadHitZone
.GetOnDamageStateChanged().Insert(
InstaDeathEffect
);
58
59
m_pDamageManager
.GetOnDamageStateChanged().Insert(OnDamageStateChanged);
60
}
61
62
//------------------------------------------------------------------------------------------------
63
private
void
OnDamageStateChanged
()
64
{
65
if
(
m_pDamageManager
.GetState() !=
EDamageState
.DESTROYED)
66
return
;
67
68
if
(
m_pHeadHitZone
.GetDamageState() !=
EDamageState
.DESTROYED)
69
DeathEffect
();
70
else
71
InstaDeathEffect
();
72
}
73
74
//------------------------------------------------------------------------------------------------
75
protected
void
DeathEffect
()
76
{
77
if
(!
m_wDeath
)
78
return
;
79
80
AnimateWidget
.
StopAllAnimations
(
m_wDeath
);
81
82
m_wDeath
.SetOpacity(
DEATHEFFECT_START_OPACITY
);
83
AnimateEffectVisibility
(
m_wDeath
,
DEATHEFFECT_FADEIN_OPACITY_TARGET
,
DEATHEFFECT_FADEIN_PROGRESSION_TARGET
,
DEATHEFFECT_FADEIN_OPACITY_DURATION
,
DEATHEFFECT_FADEIN_PROGRESSION_DURACTION
);
84
}
85
86
//------------------------------------------------------------------------------------------------
87
protected
void
InstaDeathEffect
()
88
{
89
if
(!
m_wDeath
)
90
return
;
91
92
if
(
m_pHeadHitZone
.GetDamageState() !=
EDamageState
.DESTROYED)
93
return
;
94
95
if
(
m_pDamageManager
.GetState() !=
EDamageState
.DESTROYED)
96
return
;
97
98
AnimateWidget
.
StopAllAnimations
(
m_wDeath
);
99
100
m_wDeath
.SetOpacity(
INSTADEATHEFFECT_START_OPACITY
);
101
m_wDeath
.SetMaskProgress(
INSTADEATHEFFECT_START_PROGRESSION
);
102
AnimateEffectVisibility
(
m_wDeath
,
DEATHEFFECT_FADEIN_OPACITY_TARGET
,
DEATHEFFECT_FADEIN_PROGRESSION_TARGET
,
INSTADEATHEFFECT_FADEIN_OPACITY_DURATION
,
INSTADEATHEFFECT_FADEIN_PROGRESSION_DURACTION
);
103
}
104
105
//------------------------------------------------------------------------------------------------
106
protected
override
void
ClearEffects
()
107
{
108
if
(
m_pDamageManager
)
109
m_pDamageManager
.GetOnDamageStateChanged().Remove(OnDamageStateChanged);
110
111
if
(
m_pHeadHitZone
)
112
m_pHeadHitZone
.GetOnDamageStateChanged().Remove(
InstaDeathEffect
);
113
114
if
(
m_wDeath
)
115
HideSingleEffect
(
m_wDeath
);
116
}
117
}
m_wRoot
Widget m_wRoot
Definition
SCR_GameModeCleanSweep.c:25
OnDamageStateChanged
override void OnDamageStateChanged(EDamageState newState, EDamageState previousDamageState, bool isJIP)
Definition
SCR_HelicopterDamageManagerComponent.c:31
AnimateWidget
Definition
AnimateWidget.c:3
AnimateWidget::StopAllAnimations
static void StopAllAnimations(Widget w)
Definition
AnimateWidget.c:73
ChimeraCharacter
Definition
ChimeraCharacter.c:13
IEntity
Definition
IEntity.c:13
ImageWidget
Definition
ImageWidget.c:13
SCR_BaseScreenEffect
Definition
SCR_BaseScreenEffect.c:2
SCR_BaseScreenEffect::AnimateEffectVisibility
void AnimateEffectVisibility(notnull ImageWidget effectWidget, float opacity, float alpha, float opacitySpeed=1.0, float alphaSpeed=1.0, bool updateVisibility=true)
Definition
SCR_BaseScreenEffect.c:54
SCR_BaseScreenEffect::HideSingleEffect
void HideSingleEffect(notnull ImageWidget effectWidget)
Definition
SCR_BaseScreenEffect.c:69
SCR_CharacterDamageManagerComponent
Definition
SCR_CharacterDamageManagerComponent.c:19
SCR_DeathScreenEffect
Definition
SCR_DeathScreenEffect.c:2
SCR_DeathScreenEffect::DeathEffect
void DeathEffect()
Definition
SCR_DeathScreenEffect.c:75
SCR_DeathScreenEffect::ClearEffects
override void ClearEffects()
Definition
SCR_DeathScreenEffect.c:106
SCR_DeathScreenEffect::DEATHEFFECT_FADEIN_PROGRESSION_DURACTION
const float DEATHEFFECT_FADEIN_PROGRESSION_DURACTION
Definition
SCR_DeathScreenEffect.c:6
SCR_DeathScreenEffect::m_wBlackOut
ImageWidget m_wBlackOut
Definition
SCR_DeathScreenEffect.c:19
SCR_DeathScreenEffect::DisplayControlledEntityChanged
override void DisplayControlledEntityChanged(IEntity from, IEntity to)
Definition
SCR_DeathScreenEffect.c:37
SCR_DeathScreenEffect::m_wDeath
ImageWidget m_wDeath
Definition
SCR_DeathScreenEffect.c:18
SCR_DeathScreenEffect::INSTADEATHEFFECT_FADEIN_PROGRESSION_DURACTION
const float INSTADEATHEFFECT_FADEIN_PROGRESSION_DURACTION
Definition
SCR_DeathScreenEffect.c:12
SCR_DeathScreenEffect::m_pHeadHitZone
SCR_HitZone m_pHeadHitZone
Definition
SCR_DeathScreenEffect.c:23
SCR_DeathScreenEffect::INSTADEATHEFFECT_START_PROGRESSION
const float INSTADEATHEFFECT_START_PROGRESSION
Definition
SCR_DeathScreenEffect.c:10
SCR_DeathScreenEffect::INSTADEATHEFFECT_FADEIN_OPACITY_DURATION
const float INSTADEATHEFFECT_FADEIN_OPACITY_DURATION
Definition
SCR_DeathScreenEffect.c:11
SCR_DeathScreenEffect::InstaDeathEffect
void InstaDeathEffect()
Definition
SCR_DeathScreenEffect.c:87
SCR_DeathScreenEffect::DEATHEFFECT_START_OPACITY
const float DEATHEFFECT_START_OPACITY
Definition
SCR_DeathScreenEffect.c:4
SCR_DeathScreenEffect::DEATHEFFECT_FADEIN_PROGRESSION_TARGET
const float DEATHEFFECT_FADEIN_PROGRESSION_TARGET
Definition
SCR_DeathScreenEffect.c:15
SCR_DeathScreenEffect::DEATHEFFECT_FADEIN_OPACITY_TARGET
const float DEATHEFFECT_FADEIN_OPACITY_TARGET
Definition
SCR_DeathScreenEffect.c:14
SCR_DeathScreenEffect::DisplayStartDraw
override void DisplayStartDraw(IEntity owner)
Definition
SCR_DeathScreenEffect.c:28
SCR_DeathScreenEffect::m_pCharacterEntity
ChimeraCharacter m_pCharacterEntity
Definition
SCR_DeathScreenEffect.c:22
SCR_DeathScreenEffect::INSTADEATHEFFECT_START_OPACITY
const float INSTADEATHEFFECT_START_OPACITY
Definition
SCR_DeathScreenEffect.c:9
SCR_DeathScreenEffect::m_pDamageManager
SCR_CharacterDamageManagerComponent m_pDamageManager
Definition
SCR_DeathScreenEffect.c:24
SCR_DeathScreenEffect::DEATHEFFECT_FADEIN_OPACITY_DURATION
const float DEATHEFFECT_FADEIN_OPACITY_DURATION
Definition
SCR_DeathScreenEffect.c:5
SCR_HitZone
Definition
SCR_HitZone.c:2
EDamageState
EDamageState
Definition
EDamageState.c:13
scripts
Game
UI
ScreenEffects
SCR_DeathScreenEffect.c
Generated by
1.17.0