public override void InitializeComponent() { ObjectProtoData proto_data = ParentObject.GetCreationContext().m_proto_data; if (proto_data != null) { var variables = proto_data.m_component_variables; if (variables != null) { string value; if (variables.TryGetValue("ai_tree_id", out value)) { m_bahavior_tree_id = int.Parse(value); } } } m_behavior_tree = BehaviorTreeFactory.Instance.CreateBehaviorTree(m_bahavior_tree_id); if (m_behavior_tree != null) { m_behavior_tree.Construct(GetLogicWorld()); BTContext context = m_behavior_tree.Context; context.SetData <IExpressionVariableProvider>(BTContextKey.ExpressionVariableProvider, this); context.SetData <Entity>(BTContextKey.OwnerEntity, GetOwnerEntity()); context.SetData <AIComponent>(BTContextKey.OwnerAIComponent, this); m_behavior_tree.Active(); } }
public override void InitializeComponent() { ObjectProtoData proto_data = ParentObject.GetCreationContext().m_proto_data; if (proto_data == null) { return; } var dic = proto_data.m_component_variables; if (dic == null) { return; } string value; if (dic.TryGetValue("be_killed_experience", out value)) { m_be_killed_experience = int.Parse(value); } if (m_experience_level_table != null) { m_table = GetLogicWorld().GetConfigProvider().GetLevelTableData(m_experience_level_table); if (m_max_level > m_table.m_max_level) { m_max_level = m_table.m_max_level; } } }
public override void InitializeComponent() { ObjectProtoData proto_data = ParentObject.GetCreationContext().m_proto_data; if (proto_data == null) { return; } var dic = proto_data.m_component_variables; if (dic == null) { return; } string value; if (dic.TryGetValue("ext_x", out value)) { m_extents.x = FixPoint.Parse(value); } if (dic.TryGetValue("ext_y", out value)) { m_extents.y = FixPoint.Parse(value); } if (dic.TryGetValue("ext_z", out value)) { m_extents.z = FixPoint.Parse(value); } }
public override void InitializeComponent() { ObjectProtoData proto_data = ParentObject.GetCreationContext().m_proto_data; if (proto_data == null) { return; } var dic = proto_data.m_component_variables; if (dic == null) { return; } string value; if (dic.TryGetValue("category1", out value)) { m_category_1 = (int)CRC.Calculate(value); } if (dic.TryGetValue("category2", out value)) { m_category_2 = (int)CRC.Calculate(value); } if (dic.TryGetValue("category3", out value)) { m_category_3 = (int)CRC.Calculate(value); } }
//总有些逻辑,完全是由Gameplay自定义的 #region 初始化/销毁 protected override void PostInitializeComponent() { System.Object custom_data = ParentObject.GetCreationContext().m_custom_data; if (custom_data == null) { return; } }
public override void InitializeComponent() { ObjectProtoData proto_data = ParentObject.GetCreationContext().m_proto_data; if (proto_data == null) { return; } var dic = proto_data.m_component_variables; if (dic == null) { return; } string value; if (dic.TryGetValue("born_generator_id", out value)) { m_born_generator_cfgid = int.Parse(value); } if (dic.TryGetValue("die_generator_id", out value)) { m_die_generator_cfgid = int.Parse(value); } if (dic.TryGetValue("killer_generator_id", out value)) { m_killer_generator_cfgid = int.Parse(value); } if (dic.TryGetValue("life_time", out value)) { m_life_time = FixPoint.Parse(value); } SetLifeTime(m_life_time); EffectManager effect_manager = GetLogicWorld().GetEffectManager(); if (m_born_generator_cfgid != 0) { m_born_generator = effect_manager.CreateGenerator(m_born_generator_cfgid, GetOwnerEntity()); } if (m_die_generator_cfgid != 0) { m_die_generator = effect_manager.CreateGenerator(m_die_generator_cfgid, GetOwnerEntity()); } if (m_killer_generator_cfgid != 0) { m_killer_generator = effect_manager.CreateGenerator(m_killer_generator_cfgid, GetOwnerEntity()); } }
public override void InitializeComponent() { ObjectProtoData proto_data = ParentObject.GetCreationContext().m_proto_data; if (proto_data == null) { return; } var dic = proto_data.m_component_variables; if (dic == null) { return; } string asset; if (dic.TryGetValue("asset", out asset)) { m_asset_name = asset; } CreateModel(); }
public override void InitializeComponent() { ObjectProtoData proto_data = ParentObject.GetCreationContext().m_proto_data; if (proto_data == null) { return; } var dic = proto_data.m_component_variables; if (dic == null) { return; } string value; if (dic.TryGetValue("faction", out value)) { m_faction = (int)CRC.Calculate(value); m_faction_index = GetLogicWorld().GetFactionManager().Faction2Index(m_faction); } }
public override void InitializeComponent() { BirthPositionInfo birth_info = ParentObject.GetCreationContext().m_birth_info; if (birth_info != null) { m_current_position = birth_info.m_birth_position; m_base_angle = birth_info.m_birth_angle; m_current_space = birth_info.m_space; } else { ParentObject.GetCreationContext().m_birth_info = new BirthPositionInfo(m_current_position.x, m_current_position.y, m_current_position.z, m_base_angle); } if (m_current_space == null) { m_current_space = GetLogicWorld().GetDefaultSceneSpace(); } ObjectProtoData proto_data = ParentObject.GetCreationContext().m_proto_data; if (proto_data != null) { var dic = proto_data.m_component_variables; if (dic != null) { string value; if (dic.TryGetValue("radius", out value)) { m_radius = FixPoint.Parse(value); } } } if (m_collision_sender && m_current_space != null) { m_current_space.m_paitition.AddEntiy(this); } }
public override void InitializeComponent() { if (m_track_mode == 0) { m_track_mode = TrackModeNone; } else if (m_track_mode == TrackModeLockTarget) { m_pierce_entity = false; } if (m_trajectory_type == 0) { m_trajectory_type = TrajectoryTypeHorizontalLine; } ObjectProtoData proto_data = ParentObject.GetCreationContext().m_proto_data; if (proto_data == null) { return; } var variables = proto_data.m_component_variables; if (variables == null) { return; } string value; if (variables.TryGetValue("speed", out value)) { m_speed = FixPoint.Parse(value); } if (variables.TryGetValue("life_time", out value)) { m_life_time = FixPoint.Parse(value); } if (variables.TryGetValue("track_mode", out value)) { m_track_mode = (int)CRC.Calculate(value); } if (variables.TryGetValue("trajectory_type", out value)) { m_trajectory_type = (int)CRC.Calculate(value); } if (variables.TryGetValue("extra_hight", out value)) { m_extra_hight = FixPoint.Parse(value); } if (variables.TryGetValue("can_cross_obstacle", out value)) { m_can_cross_obstacle = bool.Parse(value); } if (variables.TryGetValue("pierce_entity", out value)) { m_pierce_entity = bool.Parse(value); } if (variables.TryGetValue("collision_faction", out value)) { m_collision_faction = (int)CRC.Calculate(value); } if (variables.TryGetValue("collision_sound", out value)) { m_collision_sound_cfgid = int.Parse(value); } if (m_pierce_entity) { m_effected_entities = new List <int>(); } }