Пример #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);
        }
Пример #2
0
        private void Parse_Base(XmlElement root, CAbilityMeta meta)
        {
            meta.sId = root.GetAttribute("id");

            ParseSimpleBaseProperty(root, meta);
            ParseCost();

            CAbilityMetaManager.AddMeta(meta);
        }