示例#1
0
    private int ShowEffect(EffectArise arise)
    {
        int childCount = 0;

        if (param == null || entity == null)
        {
            return(childCount);
        }
        if (entity.TryGetComponent(out EntityComponentModel model) == false)
        {
            return(childCount);
        }
        for (int i = 0; i < param.children.Count; ++i)
        {
            var child = param.children[i] as EntityParamEffect;
            if (child == null || string.IsNullOrEmpty(child.asset) || child.arise != arise)
            {
                continue;
            }
            childCount++;

            if (child.delay > 0)
            {
                DelayManager.Instance.AddDelayTask(child.delay, delegate()
                {
                    EffectEntity effect = BattleManager.Instance.CreateEffect(child.effectType);
                    if (effect != null && effect.Init(child, entity, mTarget, null))
                    {
                        if (action != null)
                        {
                            effect.action = action;
                            action.AddSubState(effect);
                        }
                    }
                    else
                    {
                        BattleManager.Instance.RemoveEffect(effect);
                    }
                });
            }
            else
            {
                EffectEntity effect = BattleManager.Instance.CreateEffect(child.effectType);

                if (effect != null && effect.Init(child, entity, mTarget, null))
                {
                    if (action != null)
                    {
                        effect.action = action;
                        action.AddSubState(effect);
                    }
                }
                else
                {
                    BattleManager.Instance.RemoveEffect(effect);
                }
            }
        }
        return(childCount);
    }
示例#2
0
 public override void ParseXml(XmlElement node)
 {
     effectType = node.GetAttribute("effectType").ToEnumEx <EffectType>();
     arise      = node.GetAttribute("arise").ToEnumEx <EffectArise>();
     on         = node.GetAttribute("on").ToEnumEx <EffectOn>();
     asset      = node.GetAttribute("asset");
     delay      = node.GetAttribute("delay").ToFloatEx();
     offset     = node.GetAttribute("offset").ToVector3Ex();
     base.ParseXml(node);
 }
示例#3
0
 /// <summary>
 /// 显示子特效
 /// </summary>
 /// <param name="effectType"></param>
 private void ShowEffect(EffectArise effectType)
 {
     if (param != null && param.effects != null)
     {
         for (int i = 0; i < param.effects.Count; ++i)
         {
             var effect = param.effects[i];
             if (effect.effectArise == effectType)
             {
                 EffectEntity entity = BattleManager.instance.CreateEffect(effect.type);
                 entity.Init(action, param.effects[i], parentTarget);
             }
         }
     }
 }
示例#4
0
    private void ShowEffect(EffectArise effectType)
    {
        if (param != null && param.effects != null && entity.isPool == false)
        {
            for (int i = 0; i < param.effects.Count; ++i)
            {
                if (param.effects[i].effectArise == effectType)
                {
                    var target = BattleManager.instance.GetEntity(entity.data.target);

                    if (target != null && target.isPool)
                    {
                        return;
                    }

                    EffectEntity effect = BattleManager.instance.CreateEffect(param.effects[i].type);


                    effect.Init(this, param.effects[i], target);
                }
            }
        }
    }
示例#5
0
    public override void OnDraw(ref Rect r)
    {
        base.OnDraw(ref r);
        UnityEditor.EditorGUILayout.LabelField("EffectType", effectType.ToString());
        r.height += 20;

        if (parent != null)
        {
            if (parent.GetType() == typeof(EntityParamAnimation))
            {
                arise = EffectArise.ParentBegin;
            }
            else if (parent.GetType() == typeof(EntityParamEffectTime))
            {
                arise     = (EffectArise)UnityEditor.EditorGUILayout.EnumPopup("Arise", arise);
                r.height += 20;
                if (arise == EffectArise.ParentTrigger)
                {
                    arise = EffectArise.ParentBegin;
                }
            }
            else
            {
                arise     = (EffectArise)UnityEditor.EditorGUILayout.EnumPopup("Arise", arise);
                r.height += 20;
            }
        }
        else
        {
            arise     = (EffectArise)UnityEditor.EditorGUILayout.EnumPopup("Arise", arise);
            r.height += 20;
        }
        on        = (EffectOn)UnityEditor.EditorGUILayout.EnumPopup("On", on);
        r.height += 20;
        asset     = UnityEditor.EditorGUILayout.TextField("Asset", asset);
        r.height += 20;

        if (mPrefab == null && string.IsNullOrEmpty(asset) == false)
        {
            string path = string.Format("assets/resources/r/spell_fx/{0}", asset);
            mPrefab = UnityEditor.AssetDatabase.LoadAssetAtPath <GameObject>(path);
            if (mPrefab == null)
            {
                path    = string.Format("assets/r/spell_fx/{0}", asset);
                mPrefab = UnityEditor.AssetDatabase.LoadAssetAtPath <GameObject>(path);
            }
        }

        var obj = (GameObject)UnityEditor.EditorGUILayout.ObjectField("Prefab", mPrefab, typeof(UnityEngine.GameObject), false, new GUILayoutOption[0]);

        if (obj != null && obj != mPrefab)
        {
            asset   = obj.name + ".prefab";
            mPrefab = obj;
        }
        r.height += 20;
        delay     = Mathf.Clamp(UnityEditor.EditorGUILayout.FloatField("Delay", delay), 0, float.MaxValue);
        r.height += 20;

        offset    = UnityEditor.EditorGUILayout.Vector3Field("Offset", offset);
        r.height += 30;
    }