DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Component.c
См. документацию.
1
6const string COMP_NAME_NONE = "None";
7const int COMP_TYPE_UNDEFINED = -1;
12const int COMP_TYPE_COUNT = 4;
14
16{
17
18 //==========================================
19 // Variables Private Static
20 private static string m_CompNames[COMP_TYPE_COUNT];
21
22 //==========================================
23 // Variables Private
25
26 //==========================================
27
28 void Event_OnFrame(IEntity other, float timeSlice);
30 void DebugBBoxSetColor(int color);
32 Shape DebugDirectionDraw(float distance = 1);
33 void DebugDirectionSetColor(int color);
35
36 // Methods Public Static
37 static void Init()
38 {
39 m_CompNames[COMP_TYPE_ETITY_DEBUG] = "ComponentEntityDebug";
40 m_CompNames[COMP_TYPE_ENERGY_MANAGER] = "ComponentEnergyManager";
41 m_CompNames[COMP_TYPE_BODY_STAGING] = "ComponentBodyStaging";
42 m_CompNames[COMP_TYPE_ANIMAL_BLEEDING] = "ComponentAnimalBleeding";
43 }
44
46 // GetNameByType
48 static string GetNameByType(int comp_type)
49 {
50 if ( IsTypeExist(comp_type) == false )
51 {
52 LogErrorBadCompType(comp_type, "Component->GetNameByType()");
53 return "None";
54 }
55
56 return m_CompNames[comp_type];
57 }
58
60 // IsTypeExist
62 static bool IsTypeExist(int comp_type)
63 {
64 if ( comp_type < 0 || comp_type >= COMP_TYPE_COUNT )
65 {
66 return false;
67 }
68
69 return true;
70 }
71
72
74 // LogErrorBadCompType
76 static void LogErrorBadCompType(int comp_type, string fnc_name)
77 {
78 string msg = "Bad parameter comp_type='"+comp_type.ToString()+"'. Parameter must be 0-"+(COMP_TYPE_COUNT - 1).ToString()+". Returning component name 'None'.";
79 Debug.LogError(msg, "Component", "n/a", fnc_name);
80 }
81
83 // LogWarningAlredyExist
85 static void LogWarningAlredyExist(int comp_type, string fnc_name)
86 {
87 string msg = "Component '"+Component.GetNameByType(comp_type)+"' already exists!";
88 Debug.LogError(msg, "Component", "n/a", fnc_name);
89 }
90
91 //=======================================public
92 // SetParentEntityAI
93 //=============================================
95 {
97 }
98
99 //====================================protected
100 // Awake
101 //=============================================
103 {
104
105 }
106
107 //====================================protected
108 // Init
109 //=============================================
111 {
112
113 }
114
115 //=======================================public
116 // Log
117 //=============================================
118 void LogThis(string msg, string fnc_name = "n/a")
119 {
120 //Debug.Log(msg, GetCompName(), "n/a", fnc_name, m_ThisEntityAI.ToString());
121 }
122
123 //=======================================public
124 // LogWarning
125 //=============================================
126 void LogThisWarning(string msg, string fnc_name = "n/a")
127 {
128 Debug.LogWarning(msg, GetCompName(), "n/a", fnc_name, m_ThisEntityAI.ToString());
129 }
130
131 //=======================================public
132 // LogError
133 //=============================================
134 void LogThisError(string msg, string fnc_name = "n/a")
135 {
136 Debug.LogError(msg, GetCompName(), "n/a", fnc_name, m_ThisEntityAI.ToString());
137 }
138
139 //=======================================public
140 // GetType
141 //=============================================
142 string GetCompName()
143 {
144 return Component.GetNameByType(this.GetCompType());
145 }
146
147 //=======================================public
148 // GetType
149 //=============================================
151 {
152 return COMP_TYPE_UNDEFINED;
153 }
154
155 //=======================================public
156 // Event_OnItemAttached
157 //=============================================
158 void Event_OnItemAttached(EntityAI item, string slot_name)
159 {
160 LogThis("" + item + " -> " + slot_name,"Event_OnItemAttached");
161 //Debug.Log("Component=>Event_OnItemAttached: " + item + " -> " + slot_name, );
162 }
163
164 //=======================================public
165 // Event_OnItemDetached
166 //=============================================
167 void Event_OnItemDetached(EntityAI item, string slot_name)
168 {
169 LogThis("" + item + " <- " + slot_name,"Event_OnItemDetached");
170 //Log("Component=>Event_OnItemDetached: " + item + " <- " + slot_name );
171 }
172}
proto string ToString()
Shape DebugDirectionDraw(float distance=1)
EntityAI m_ThisEntityAI
Определения Component.c:24
void SetParentEntityAI(EntityAI e)
Определения Component.c:94
static void LogErrorBadCompType(int comp_type, string fnc_name)
Определения Component.c:76
static void LogWarningAlredyExist(int comp_type, string fnc_name)
Определения Component.c:85
string GetCompName()
Определения Component.c:142
void LogThis(string msg, string fnc_name="n/a")
Определения Component.c:118
static string GetNameByType(int comp_type)
Определения Component.c:48
void Event_OnInit()
Определения Component.c:110
void DebugDirectionDelete()
void DebugBBoxDelete()
void Event_OnItemDetached(EntityAI item, string slot_name)
Определения Component.c:167
void Event_OnFrame(IEntity other, float timeSlice)
static bool IsTypeExist(int comp_type)
Определения Component.c:62
void DebugDirectionSetColor(int color)
void LogThisWarning(string msg, string fnc_name="n/a")
Определения Component.c:126
int GetCompType()
Определения Component.c:150
void Event_OnAwake()
Определения Component.c:102
void LogThisError(string msg, string fnc_name="n/a")
Определения Component.c:134
Shape DebugBBoxDraw()
static string m_CompNames[COMP_TYPE_COUNT]
Определения Component.c:20
void DebugBBoxSetColor(int color)
static void Init()
Определения Component.c:37
void Event_OnItemAttached(EntityAI item, string slot_name)
Определения Component.c:158
Определения Component.c:16
static void LogWarning(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as warning message.
Определения Debug.c:230
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Определения Debug.c:245
Определения Debug.c:2
Определения Building.c:6
Определения EnEntity.c:165
const int COMP_TYPE_ANIMAL_BLEEDING
Определения Component.c:11
const int COMP_TYPE_BODY_STAGING
Определения Component.c:10
const string COMP_NAME_NONE
Определения Component.c:6
const int COMP_TYPE_COUNT
Определения Component.c:12
const int COMP_TYPE_UNDEFINED
Определения Component.c:7
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
const int COMP_TYPE_ETITY_DEBUG
Определения Component.c:8
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead