Пример #1
0
        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;
                }
            }
        }
Пример #2
0
 public void Destruct()
 {
     m_custom_data = null;
     m_type_data   = null;
     m_proto_data  = null;
     m_logic_world = null;
 }
Пример #3
0
        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();
            }
        }
Пример #4
0
        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);
            }
        }
Пример #6
0
        public ObjectProtoData GetObjectProtoData(int id)
        {
            ObjectProtoData proto_data = null;

            if (!m_object_proto_data.TryGetValue(id, out proto_data))
            {
                return(null);
            }
            return(proto_data);
        }
Пример #7
0
        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());
            }
        }
Пример #8
0
        void InitObjectProtoData()
        {
            ObjectProtoData proto_data = new ObjectProtoData();

            proto_data.m_name = "Cube";
            proto_data.m_component_variables["asset"] = "Objects/3D/zzw_cube";
            m_object_proto_data[101001] = proto_data;

            proto_data        = new ObjectProtoData();
            proto_data.m_name = "Sphere";
            proto_data.m_component_variables["asset"] = "Objects/3D/zzw_sphere";
            m_object_proto_data[101002] = proto_data;

            proto_data        = new ObjectProtoData();
            proto_data.m_name = "missile_entity";
            proto_data.m_component_variables["speed"]     = "15";
            proto_data.m_component_variables["life_time"] = "10";
            proto_data.m_component_variables["asset"]     = "Objects/3D/zzw_missile_entity";
            m_object_proto_data[103001] = proto_data;

            proto_data        = new ObjectProtoData();
            proto_data.m_name = "ssx_legacy";
            proto_data.m_component_variables["asset"]                     = "Objects/3D/zzw_ssx_legacy";
            proto_data.m_attributes[(int)CRC.Calculate("测试属性1")]          = "1";
            proto_data.m_attributes[(int)CRC.Calculate("TestAttribute2")] = "2";
            proto_data.m_attributes[(int)CRC.Calculate("TestAttribute3")] = "3";
            proto_data.m_attributes[(int)CRC.Calculate("TestAttribute4")] = "4";
            proto_data.m_attributes[(int)CRC.Calculate("TestAttribute5")] = "5";
            proto_data.m_attributes[(int)CRC.Calculate("TestAttribute6")] = "6";
            proto_data.m_attributes[(int)CRC.Calculate("MaxHealth")]      = "1000";
            proto_data.m_skills[0]      = 1001;
            m_object_proto_data[111001] = proto_data;

            proto_data        = new ObjectProtoData();
            proto_data.m_name = "ssx_mecanim";
            proto_data.m_component_variables["asset"] = "Objects/3D/zzw_ssx_mecanim";
            proto_data.m_skills[0]      = 1011;
            m_object_proto_data[112001] = proto_data;
        }
Пример #9
0
        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();
        }
Пример #10
0
        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);
            }
        }
Пример #11
0
        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);
            }
        }
Пример #12
0
        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>();
            }
        }