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
 /// <summary>
 /// 选择使用某个技能
 /// </summary>
 /// <param name="index"></param>
 public void SelectAbility(int index)
 {
     if (index >= m_abilityList.Count)
     {
         m_selectedAbility = null;
         return;
     }
     m_selectedAbility = m_abilityList[index];
 }
Exemplo n.º 3
0
 /// <summary>
 /// 掌握具体的技能
 /// </summary>
 /// <param name="ability"></param>
 public void MasterAbility(CAbility ability)
 {
     if (m_abilityList.Contains(ability))
     {
         return;
     }
     ability.Index = m_abilityList.Count;
     m_abilityList.Add(ability);
     m_abilityDict[ability.AbilityName] = ability;
 }
Exemplo n.º 4
0
        /// <summary>
        /// actor掌握新技能
        /// </summary>
        /// <param name="meta"></param>
        public CAbility MasterAbility(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }

            CAbility abi = CAbility.Create(name, gameObject);

            if (abi == null)
            {
                return(null);
            }

            abi.InitAbilityActorInfo(m_owner, m_owner);
            abi.Index = m_abilityList.Count;

            m_abilityList.Add(abi);
            m_abilityDict[name] = abi;

            return(abi);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 取消选中的技能
 /// </summary>
 public void CancelSelectedAbility()
 {
     m_selectedAbility = null;
 }
Exemplo n.º 6
0
 /// <summary>
 /// 选择使用某个技能
 /// </summary>
 /// <param name="index"></param>
 public void SelectAbility(string name)
 {
     m_selectedAbility = m_abilityDict[name];
 }