/// <summary> /// 给目标添加效果 /// </summary> public void ApplyGameplayEffectToTarget(CEffectMeta effectMeta, IGameplayAbilityUnit target) { if (target == null) { return; } target.AbilitySystem.ApplyGameplayEffectToSelf(effectMeta, m_owner); }
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; }
/// <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); }
/// <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); }
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); }
/// <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); }
/// <summary> /// 获取自己身上的可用的CEffect /// </summary> private CEffect GetSleepingEffectOnSelf(CEffectMeta effectMeta) { return(null); }