Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
cacontinuoustime.c
Go to the documentation of this file.
2{
3 protected float m_LocalTimeElpased;
4 protected float m_TimeElpased;
5 protected float m_AdjustedTimeToComplete;
6 protected float m_DefaultTimeToComplete;
7 protected ref Param1<float> m_SpentUnits;
8
9 void CAContinuousTime( float time_to_complete_action )
10 {
11 m_DefaultTimeToComplete = time_to_complete_action;
12 }
13
14 override void Setup( ActionData action_data )
15 {
16 m_TimeElpased = 0;
17 if ( !m_SpentUnits )
18 {
19 m_SpentUnits = new Param1<float>(0);
20 }
21 else
22 {
23 m_SpentUnits.param1 = 0;
24 }
25
27 }
28
29 override int Execute( ActionData action_data )
30 {
31 if ( m_DefaultTimeToComplete < 0 ) //for infinite actions
32 {
33 return UA_PROCESSING;
34 }
35
36 if ( !action_data.m_Player )
37 {
38 return UA_ERROR;
39 }
40
42 {
43 m_TimeElpased += action_data.m_Player.GetDeltaT();
44 return UA_PROCESSING;
45 }
46 else
47 {
48 if ( m_SpentUnits )
49 {
52 }
53 OnCompletePogress(action_data);
54 return UA_FINISHED;
55 }
56 }
57
58 override int Cancel(ActionData action_data )
59 {
60 if ( m_SpentUnits )
61 {
64 }
65 if ( m_DefaultTimeToComplete < 0 ) //for infinite actions
66 {
67 return UA_FINISHED;
68 }
69
70 return UA_CANCEL;
71 }
72
73 override float GetProgress()
74 {
75 if ( m_AdjustedTimeToComplete != 0 )
76 {
77 //progress = m_TimeElpased/m_AdjustedTimeToComplete;
79 }
80 else
81 {
82 Print("USER ACTION COMPONENT CONTINUOUS TIME - WRONG TIME TO COMPLETE CALCULATION - Incorrect data for progress bar!");
83 }
84 return 1;
85 }
86
87};
void SetACData(Param units)
Definition cabase.c:40
override int Execute(ActionData action_data)
ref Param1< float > m_SpentUnits
override void Setup(ActionData action_data)
void CAContinuousTime(float time_to_complete_action)
override float GetProgress()
override int Cancel(ActionData action_data)
proto void Print(void var)
Prints content of variable to console/log.
const int UA_FINISHED
Definition constants.c:466
const int UA_ERROR
Definition constants.c:485
const int UA_PROCESSING
Definition constants.c:464
const int UA_CANCEL
Definition constants.c:467