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_CharacterAnimationEventCinematicTrack.c
Go to the documentation of this file.
1
[
CinematicTrackAttribute
(name:
"Character Animation Event Track"
, description:
"Uses character animation events to do stuff"
)]
2
class
SCR_CharacterAnimationEventCinematicTrack
:
SCR_CinematicTrackBase
3
{
4
static
const
string
EVENT_NAME_SIGNAL =
"SignalCinematicTimeline"
;
5
static
const
string
EVENT_NAME_SOUND =
"SoundCinematicTimeline"
;
6
7
[
Attribute
(
""
)]
8
protected
string
m_sSourceEntityName
;
9
10
[
Attribute
(
""
)]
11
protected
bool
m_bUsePlayerCharacter
;
12
13
[
Attribute
(
""
)]
14
protected
string
m_sTargerEntityName
;
15
16
bool
m_bIsFirstFrame
=
true
;
17
18
//------------------------------------------------------------------------------------------------
25
protected
void
OnAnimationEvent
(
AnimationEventID
animEventType,
AnimationEventID
animUserString,
int
intParam,
float
timeFromStart,
float
timeToEnd)
26
{
27
const
string
eventName =
GameAnimationUtils
.GetEventString(animEventType);
28
29
// Sets signal on animation event
30
// animUserString = signal name
31
// intParam = signal value
32
if
(eventName == EVENT_NAME_SIGNAL)
33
{
34
IEntity
entity =
FindOwner
(
m_sTargerEntityName
);
35
if
(!entity)
36
{
37
return
;
38
}
39
40
SignalsManagerComponent
signalsManagerComponent =
SignalsManagerComponent
.Cast(entity.
FindComponent
(
SignalsManagerComponent
));
41
if
(!signalsManagerComponent)
42
{
43
return
;
44
}
45
46
const
string
signalName =
GameAnimationUtils
.GetEventString(animUserString);
47
signalsManagerComponent.SetSignalValue(signalsManagerComponent.AddOrFindSignal(signalName), intParam);
48
}
49
// Plays sound on linked entity
50
// animUserString = sound event name
51
else
if
(eventName == EVENT_NAME_SOUND)
52
{
53
IEntity
entity =
FindOwner
(
m_sTargerEntityName
);
54
if
(!entity)
55
{
56
return
;
57
}
58
59
SoundComponent
soundComponent =
SoundComponent
.Cast(entity.
FindComponent
(
SoundComponent
));
60
if
(!soundComponent)
61
{
62
return
;
63
}
64
65
const
string
soundEventName =
GameAnimationUtils
.GetEventString(animUserString);
66
soundComponent.SoundEvent(soundEventName);
67
}
68
}
69
70
IEntity
GetSourceEntity
()
71
{
72
if
(
m_bUsePlayerCharacter
)
73
{
74
PlayerController playerController =
GetGame
().GetPlayerController();
75
if
(!playerController)
76
{
77
return
null;
78
}
79
80
return
playerController.GetControlledEntity();
81
}
82
else
83
{
84
return
FindOwner
(
m_sSourceEntityName
);
85
}
86
}
87
88
override
void
OnApply
(
float
time)
89
{
90
super.OnApply(time);
91
92
if
(
m_bIsFirstFrame
)
93
{
94
// Register to OnAnimation event
95
const
IEntity
sourceEntity =
GetSourceEntity
();
96
if
(!sourceEntity)
97
{
98
return
;
99
}
100
101
const
SCR_ChimeraCharacter chimeraCharacter = SCR_ChimeraCharacter.Cast(sourceEntity);
102
if
(!chimeraCharacter)
103
{
104
return
;
105
}
106
107
SCR_CharacterControllerComponent
characterController =
SCR_CharacterControllerComponent
.Cast(chimeraCharacter.FindComponent(
SCR_CharacterControllerComponent
));
108
if
(!characterController)
109
{
110
return
;
111
}
112
113
characterController.
GetOnAnimationEvent
().Insert(
OnAnimationEvent
);
114
115
m_bIsFirstFrame
=
false
;
116
}
117
}
118
119
override
void
OnFinish
()
120
{
121
super.OnFinish();
122
123
// Unregister OnAnimation event
124
const
IEntity
sourceEntity =
GetSourceEntity
();
125
if
(!sourceEntity)
126
{
127
return
;
128
}
129
130
const
SCR_ChimeraCharacter chimeraCharacter = SCR_ChimeraCharacter.Cast(sourceEntity);
131
if
(!chimeraCharacter)
132
{
133
return
;
134
}
135
136
SCR_CharacterControllerComponent
characterController =
SCR_CharacterControllerComponent
.Cast(chimeraCharacter.FindComponent(
SCR_CharacterControllerComponent
));
137
if
(!characterController)
138
{
139
return
;
140
}
141
142
characterController.
GetOnAnimationEvent
().Remove(
OnAnimationEvent
);
143
}
144
}
AnimationEventID
int AnimationEventID
Definition
AnimationStringTypes.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
CinematicTrackAttribute
Definition
attributes.c:3
GameAnimationUtils
Definition
GameAnimationUtils.c:8
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
SCR_CharacterAnimationEventCinematicTrack
Definition
SCR_CharacterAnimationEventCinematicTrack.c:3
SCR_CharacterAnimationEventCinematicTrack::m_sTargerEntityName
string m_sTargerEntityName
Definition
SCR_CharacterAnimationEventCinematicTrack.c:14
SCR_CharacterAnimationEventCinematicTrack::OnFinish
override void OnFinish()
Definition
SCR_CharacterAnimationEventCinematicTrack.c:119
SCR_CharacterAnimationEventCinematicTrack::m_bUsePlayerCharacter
bool m_bUsePlayerCharacter
Definition
SCR_CharacterAnimationEventCinematicTrack.c:11
SCR_CharacterAnimationEventCinematicTrack::m_sSourceEntityName
string m_sSourceEntityName
Definition
SCR_CharacterAnimationEventCinematicTrack.c:8
SCR_CharacterAnimationEventCinematicTrack::m_bIsFirstFrame
bool m_bIsFirstFrame
Definition
SCR_CharacterAnimationEventCinematicTrack.c:16
SCR_CharacterAnimationEventCinematicTrack::OnAnimationEvent
void OnAnimationEvent(AnimationEventID animEventType, AnimationEventID animUserString, int intParam, float timeFromStart, float timeToEnd)
Definition
SCR_CharacterAnimationEventCinematicTrack.c:25
SCR_CharacterAnimationEventCinematicTrack::GetSourceEntity
IEntity GetSourceEntity()
Definition
SCR_CharacterAnimationEventCinematicTrack.c:70
SCR_CharacterAnimationEventCinematicTrack::OnApply
override void OnApply(float time)
Definition
SCR_CharacterAnimationEventCinematicTrack.c:88
SCR_CharacterControllerComponent
Definition
SCR_CharacterControllerComponent.c:36
SCR_CharacterControllerComponent::GetOnAnimationEvent
ScriptInvoker GetOnAnimationEvent()
Definition
SCR_CharacterControllerComponent.c:185
SCR_CinematicTrackBase
Definition
SCR_CinematicTrackBase.c:3
SCR_CinematicTrackBase::FindOwner
IEntity FindOwner()
Definition
SCR_CinematicTrackBase.c:12
SignalsManagerComponent
Definition
SignalsManagerComponent.c:13
SoundComponent
Definition
SoundComponent.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Cinematics
SCR_CharacterAnimationEventCinematicTrack.c
Generated by
1.17.0