示例#1
0
 /// <summary>
 /// 给目标添加效果
 /// </summary>
 public void ApplyGameplayEffectToTarget(CEffectMeta effectMeta, IGameplayAbilityUnit target)
 {
     if (target == null)
     {
         return;
     }
     target.AbilitySystem.ApplyGameplayEffectToSelf(effectMeta, m_owner);
 }
示例#2
0
        public static void AddMeta(CEffectMeta meta)
        {
            if (m_dict.ContainsKey(meta.sId))
            {
                Debug.LogError("CEffectMetaManager ALREADY CONTAIN the ability with id -- " + meta.sId);
            }

            m_dict[meta.sId] = meta;
        }
示例#3
0
        /// <summary>
        /// 给自己添加效果, 要指定效果来源
        /// </summary>
        private void ApplyGameplayEffectToSelf(CEffectMeta effectMeta, IGameplayAbilityUnit instigator)
        {
            var effect = GetSleepingEffectOnSelf(effectMeta);

            if (effect == null)
            {
                Debug.Log("Effect MUST NOT Null here. Check the code or config");
                return;
            }

            effect.AppliedFrom(instigator);
        }
示例#4
0
        /// <summary>
        /// 朝某个位置应用效果
        /// </summary>
        public void ApplyGameplayEffectToPosition(CEffectMeta effectMeta, Vector3 localPostion)
        {
            var effect = GetSleepingEffectOnSelf(effectMeta);

            if (effect == null)
            {
                Debug.Log("Effect MUST NOT Null here. Check the code or config");
                return;
            }

            effect.ApplyToPosition(localPostion);
        }
示例#5
0
        public static CEffectMeta GetMeta(string id)
        {
            CEffectMeta meta = null;
            bool        v    = m_dict.TryGetValue(id, out meta);

            if (!v)
            {
                Debug.LogError("CEffectMetaManager DO NOT CONTAIN the ability with id -- " + id);
            }

            return(meta);
        }
示例#6
0
        /// <summary>
        /// 给owner创建一个Effect组件, 并挂在Effect Child Layer身上
        /// </summary>
        public static CEffect Create(string meta, IGameplayAbilityUnit owner)
        {
            CEffect     eff   = null;
            CEffectMeta emeta = CEffectMetaManager.GetMeta(meta);

            if (owner == null)
            {
                Debug.LogError("We can not get GameObject which effect attach on " + meta);
                return(null);
            }

            GameObject go = owner.EffectLayer;

            switch (emeta.Type)
            {
            case CEffectMeta.EffectType.LaunchMissle:
                eff            = go.AddComponent <CEffectLaunchMissile>();
                eff.EffectName = meta;
                break;

            case CEffectMeta.EffectType.Damage:
                eff            = go.AddComponent <CEffectDamage>();
                eff.EffectName = meta;
                break;

            case CEffectMeta.EffectType.ApplyBehaviour:
                eff            = go.AddComponent <CEffectApplyBuff>();
                eff.EffectName = meta;
                break;

            case CEffectMeta.EffectType.IssueOrder:
                eff            = go.AddComponent <CEffectIssueOrder>();
                eff.EffectName = meta;
                break;

            case CEffectMeta.EffectType.EnumArea:
                eff            = go.AddComponent <CEffectEnumArea>();
                eff.EffectName = meta;
                break;

            case CEffectMeta.EffectType.EffectSet:
                eff            = go.AddComponent <CEffectSet>();
                eff.EffectName = meta;
                break;
            }

            return(eff);
        }
示例#7
0
 /// <summary>
 /// 获取自己身上的可用的CEffect
 /// </summary>
 private CEffect GetSleepingEffectOnSelf(CEffectMeta effectMeta)
 {
     return(null);
 }