Exemple #1
0
        public static EffectBase CreateEffect(EffectInfoData data)
        {
            Type       effectClass = Type.GetType("GamePlay." + data.EffectID);
            object     effect_obj  = Activator.CreateInstance(effectClass);
            EffectBase effect      = null;

            if (effect_obj != null)
            {
                effect = (EffectBase)effect_obj;
                effect.InitEffect(data.elementPtoprtty, data.EffectParam1, data.EffectParam2);
            }
            else
            {
                Debug.LogError("effect id can not be find!");
            }
            return(effect);
        }
Exemple #2
0
        public IEnumerator OnTriggerBuff(params object[] param)
        {
            bool TriggerEffect = true;

            if (triggerCondition != null)
            {
                TriggerEffect = triggerCondition.GetTriggerCondition(m_BuffData.TriggerParam, param);
            }
            if (TriggerEffect)
            {
                foreach (EffectInfoData effect_info in m_BuffData.EffectList)
                {
                    EffectBase        effect  = EffectFactory.CreateEffect(effect_info);
                    List <GamePlayer> targets = null;
                    yield return(GameEngine.Instance.StartCoroutine(GameTargetManager.Instance.StartGetTarget(OwnPlayer, effect_info.TargetType)));

                    targets = GameTargetManager.Instance.GetChoosedTarget();
                    if (targets != null)
                    {
                        effect.TakeEffect(OwnPlayer, targets, effect_info.EffectParam1, effect_info.EffectParam2);
                    }
                }
            }
        }