DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ CreateComponent()

Component ComponentsBank::CreateComponent ( int comp_type,
string extended_class_name = "" )
inlineprivate

См. определение в файле ComponentsBank.c строка 38

39 {
40 if ( !Component.IsTypeExist(comp_type) )
41 {
42 Component.LogErrorBadCompType(comp_type, "EntityAI->CreateComponent(int comp_type)");
43 return NULL;
44 }
45
46 if ( IsComponentAlreadyExist(comp_type) )
47 {
48 Component.LogWarningAlredyExist(comp_type, "EntityAI->CreateComponent(int comp_type)");
49 return m_Components[comp_type];
50 }
51
52
53 string clas_name = extended_class_name;
54
55 if ( clas_name == string.Empty )
56 {
57 clas_name = Component.GetNameByType(comp_type);
58 }
59
60 Component comp = Component.Cast(clas_name.ToType().Spawn());
61
63 comp.Event_OnAwake();
64
65 m_Components[comp_type] = comp;
66
67 comp.Event_OnInit();
68
69 return comp;
70 }
Empty
Определения Hand_States.c:14
void SetParentEntityAI(EntityAI e)
Определения Component.c:94
void Event_OnInit()
Определения Component.c:110
void Event_OnAwake()
Определения Component.c:102
bool IsComponentAlreadyExist(int comp_type)
Определения ComponentsBank.c:72
ref Component m_Components[COMP_TYPE_COUNT]
Определения ComponentsBank.c:4
EntityAI m_EntityParent
Определения ComponentsBank.c:3
proto native ToType()
Returns internal type representation. Can be used in runtime, or cached in variables and used for fas...

Перекрестные ссылки Empty, Component::Event_OnAwake(), Component::Event_OnInit(), Component::GetNameByType(), IsComponentAlreadyExist(), Component::IsTypeExist(), Component::LogErrorBadCompType(), Component::LogWarningAlredyExist(), m_Components, m_EntityParent, Component::SetParentEntityAI() и string::ToType().

Используется в GetComponent().