Exemplo n.º 1
0
        /// <summary>
        /// 创建技能组件, 并挂在owner身上
        /// </summary>
        public static CAbility Create(string meta, GameObject owner)
        {
            CAbility ability = null;

            CAbilityMeta emeta = CAbilityMetaManager.GetMeta(meta);

            switch (emeta.Type)
            {
            case CAbilityType.Attack:
                ability             = owner.AddComponent <CAbilityAttack>();
                ability.AbilityName = meta;
                break;

            case CAbilityType.EffectTarget:
                ability             = owner.AddComponent <CAbilitylEffectTarget>();
                ability.AbilityName = meta;
                break;
            }

            if (ability == null)
            {
                Debug.LogError(meta + " ability we are not handle");
            }

            return(ability);
        }
Exemplo n.º 2
0
        private void Parse_Base(XmlElement root, CAbilityMeta meta)
        {
            meta.sId = root.GetAttribute("id");

            ParseSimpleBaseProperty(root, meta);
            ParseCost();

            CAbilityMetaManager.AddMeta(meta);
        }
Exemplo n.º 3
0
        public static void AddMeta(CAbilityMeta meta)
        {
            if (m_dict.ContainsKey(meta.sId))
            {
                Debug.LogError(string.Format("CAbilityMetaManager ALREADY CONTAIN the ability with id -- {0} ", meta.sId));
            }

            m_dict[meta.sId] = meta;
        }
Exemplo n.º 4
0
        public static CAbilityMeta GetMeta(string id)
        {
            CAbilityMeta meta = null;
            bool         v    = m_dict.TryGetValue(id, out meta);

            if (!v)
            {
                Debug.LogError(string.Format("CAbilityMetaManager DO NOT CONTAIN the ability with id -- {0} ", id));
            }
            return(meta);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 解析技能的简单的属性
 /// </summary>
 private void ParseSimpleBaseProperty(XmlElement root, CAbilityMeta meta)
 {
     m_xreader.TryReadChildNodeAttr(root, "Clip", "value", ref meta.Clip);
     m_xreader.TryReadChildNodeAttr(root, "Period", "value", ref meta.Period);
 }