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_AIAnimateActivity.c
Go to the documentation of this file.
1
class
SCR_AIAnimateActivity
:
SCR_AIActivityBase
2
{
3
protected
ref array<AIAgent>
m_aAgentsAnimating
= {};
4
5
//------------------------------------------------------------------------------------------------
6
void
SCR_AIAnimateActivity
(
SCR_AIGroupUtilityComponent
utility, AIWaypoint relatedWaypoint,
float
priority = PRIORITY_ACTIVITY_ANIMATE,
float
priorityLevel =
PRIORITY_LEVEL_NORMAL
)
7
{
8
SetPriority(priority);
9
m_fPriorityLevel
.Init(
this
, priorityLevel);
10
}
11
12
//------------------------------------------------------------------------------------------------
13
bool
AddAgentToAnimatedAgents
(AIAgent agent)
14
{
15
if
(
m_aAgentsAnimating
.Find(agent) > -1)
16
{
17
Print
(
"Agent added twice to list of animated agents!"
,
LogLevel
.WARNING);
18
return
false
;
19
}
20
m_aAgentsAnimating
.Insert(agent);
21
return
true
;
22
}
23
24
//------------------------------------------------------------------------------------------------
25
bool
RemoveAgentFromAnimatedAgents
(AIAgent agent,
bool
isSuccess)
26
{
27
int
index
=
m_aAgentsAnimating
.Find(agent);
28
if
(
index
< 0)
29
{
30
Print
(
"Agent is not animated!"
,
LogLevel
.WARNING);
31
return
false
;
32
}
33
m_aAgentsAnimating
.Remove(
index
);
34
if
(
m_aAgentsAnimating
.IsEmpty())
35
{
36
if
(isSuccess)
37
Complete();
38
else
39
Fail
();
40
if
(
m_RelatedWaypoint
)
41
m_Utility
.m_Owner.CompleteWaypoint(
m_RelatedWaypoint
);
42
}
43
return
true
;
44
}
45
46
//------------------------------------------------------------------------------------------------
47
override
void
OnActionSelected
()
48
{
49
//we distribute now all animation scripts to all our agents, in future one might use beh tree if the distribution becomes context-related
50
array<AIAgent> agents = {};
51
m_Utility
.m_Owner.GetAgents(agents);
52
AICommunicationComponent myComms =
m_Utility
.m_Owner.GetCommunicationComponent();
53
SCR_AIAnimationWaypoint
waypoint =
SCR_AIAnimationWaypoint
.Cast(
m_RelatedWaypoint
);
54
if
(!waypoint)
55
return
;
56
foreach
(
int
index
, AIAgent agent: agents)
57
{
58
if
(!waypoint.m_aAnimationScripts.IsIndexValid(
index
))
59
break
;
60
SCR_AIMessageHandling.SendAnimateMessage(agent, waypoint, waypoint.m_aAnimationScripts[
index
],
this
, waypoint.
GetOnAnimationBehaviorAction
(), myComms,
"Animate activity director"
);
61
}
62
}
63
64
//------------------------------------------------------------------------------------------------
65
override
string
GetActionDebugInfo
()
66
{
67
return
this.
ToString
() +
" animating on "
+
m_RelatedWaypoint
.ToString();
68
}
69
70
//------------------------------------------------------------------------------------------------
71
override
void
OnActionFailed
()
72
{
73
super.OnActionFailed();
74
SendCancelMessagesToAllAgents
();
75
}
76
};
m_fPriorityLevel
ref SCR_BTParam< float > m_fPriorityLevel
Definition
SCR_AIAction.c:87
PRIORITY_LEVEL_NORMAL
enum EAIActionFailReason PRIORITY_LEVEL_NORMAL
Fail
void Fail(bool doNotCompleteWaypoint)
Definition
SCR_AIActivity.c:75
SendCancelMessagesToAllAgents
void SendCancelMessagesToAllAgents()
Definition
SCR_AIActivity.c:51
SCR_AIActivityBase
void SCR_AIActivityBase(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
Definition
SCR_AIActivity.c:44
m_Utility
enum SCR_EAIActivityCause m_Utility
m_RelatedWaypoint
AIWaypoint m_RelatedWaypoint
Definition
SCR_AIActivity.c:15
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
SCR_AIAnimateActivity::RemoveAgentFromAnimatedAgents
bool RemoveAgentFromAnimatedAgents(AIAgent agent, bool isSuccess)
Definition
SCR_AIAnimateActivity.c:25
SCR_AIAnimateActivity::m_aAgentsAnimating
ref array< AIAgent > m_aAgentsAnimating
Definition
SCR_AIAnimateActivity.c:3
SCR_AIAnimateActivity::OnActionSelected
override void OnActionSelected()
Definition
SCR_AIAnimateActivity.c:47
SCR_AIAnimateActivity::GetActionDebugInfo
override string GetActionDebugInfo()
Definition
SCR_AIAnimateActivity.c:65
SCR_AIAnimateActivity::SCR_AIAnimateActivity
void SCR_AIAnimateActivity(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint, float priority=PRIORITY_ACTIVITY_ANIMATE, float priorityLevel=PRIORITY_LEVEL_NORMAL)
Definition
SCR_AIAnimateActivity.c:6
SCR_AIAnimateActivity::OnActionFailed
override void OnActionFailed()
Definition
SCR_AIAnimateActivity.c:71
SCR_AIAnimateActivity::AddAgentToAnimatedAgents
bool AddAgentToAnimatedAgents(AIAgent agent)
Definition
SCR_AIAnimateActivity.c:13
SCR_AIAnimationWaypoint
Definition
SCR_AIAnimationWaypoint.c:149
SCR_AIAnimationWaypoint::GetOnAnimationBehaviorAction
ScriptInvokerBase< SCR_AIOnAnimationBehaviorAction > GetOnAnimationBehaviorAction()
Definition
SCR_AIAnimationWaypoint.c:181
SCR_AIGroupUtilityComponent
Definition
SCR_AIGroupUtilityComponent.c:18
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
ToString
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
scripts
Game
AI
Behavior
SCR_AIAnimateActivity.c
Generated by
1.17.0