示例#1
0
 public bool Create(SkillEffectProp prop)
 {
     m_Prop = null;
     m_Prop = prop;
     CreateEffectNode(m_Prop);
     return(true);
 }
示例#2
0
        public void Destroy()
        {
            if (m_Prop != null)
            {
                m_Prop = null;
            }

            SortedDictionary <float, List <EffectNode> > .Enumerator iter = m_EffectNodes.GetEnumerator();
            while (iter.MoveNext())
            {
                for (int i = 0; i < iter.Current.Value.Count; ++i)
                {
                    if (iter.Current.Value[i] == null)
                    {
                        continue;
                    }

                    iter.Current.Value[i] = null;
                }

                iter.Current.Value.Clear();
                foreach (var node in iter.Current.Value)
                {
                    FreeSkillNode(node);
                }
            }

            m_EffectNodes.Clear();

            m_Atttacker = null;
        }
示例#3
0
        public bool Add(SkillEffectProp e)
        {
            if (m_effectDict.ContainsKey(e.Name) == true)
            {
                return(false); //重名
            }

            m_effectDict.Add(e.Name, e);
            return(true);
        }
示例#4
0
        public SkillEffectProp Add(string name)
        {
            SkillEffectProp e = ScriptableObject.CreateInstance <SkillEffectProp>();// new SkillEffectProp();

            e.Name = name;

            if (Add(e) == false)
            {
                return(null);
            }

            return(e);
        }
示例#5
0
        //-------------------------------------------------------------------------------------------------------

        /**
         * @brief 创建特效
         * @param
         */
        private void CreateEffectNode(SkillEffectProp prop)
        {
            SortedDictionary <float, EffectNodeConfig> .Enumerator iter = prop.m_EffectProps.GetEnumerator();
            while (iter.MoveNext())
            {
                for (int i = 0; i < iter.Current.Value.configlist.Count; ++i)
                {
                    EffectNodeProp nodeprop = iter.Current.Value.configlist[i];
                    EffectNode     node     = CreateEffectNode(nodeprop.type);
                    if (node == null)
                    {
                        continue;
                    }

                    node.Create(nodeprop);
                    AddEffectNode(nodeprop.time, node);
                }
            }
        }
示例#6
0
        public bool Load(JsonData json_root)
        {
            #region 以名字为key
            name = json_root.GetString("name", "");

            JsonData effect_nodes = json_root["effects"];

            if (effect_nodes != null)
            {
                for (int n = 0; n < effect_nodes.Count; n++)
                {
                    SkillEffectProp e = ScriptableObject.CreateInstance <SkillEffectProp>(); //new SkillEffectProp();
                    e.Load(effect_nodes[n]);
                    Add(e);
                }
            }
            #endregion

            return(true);
        }
示例#7
0
 public void Remove(SkillEffectProp e)
 {
     m_effectDict.Remove(e.Name);
 }