Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIAnimateActivity.c
Go to the documentation of this file.
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 }
34 if (m_aAgentsAnimating.IsEmpty())
35 {
36 if (isSuccess)
37 Complete();
38 else
39 Fail();
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();
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();
75 }
76};
ref SCR_BTParam< float > m_fPriorityLevel
enum EAIActionFailReason PRIORITY_LEVEL_NORMAL
void Fail(bool doNotCompleteWaypoint)
void SendCancelMessagesToAllAgents()
void SCR_AIActivityBase(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
enum SCR_EAIActivityCause m_Utility
AIWaypoint m_RelatedWaypoint
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
bool RemoveAgentFromAnimatedAgents(AIAgent agent, bool isSuccess)
ref array< AIAgent > m_aAgentsAnimating
override string GetActionDebugInfo()
void SCR_AIAnimateActivity(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint, float priority=PRIORITY_ACTIVITY_ANIMATE, float priorityLevel=PRIORITY_LEVEL_NORMAL)
bool AddAgentToAnimatedAgents(AIAgent agent)
ScriptInvokerBase< SCR_AIOnAnimationBehaviorAction > GetOnAnimationBehaviorAction()
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.