Ejemplo n.º 1
0
        public override void OnLoadComplete()
        {
            SkillAreaConfig skillConfig = ConfigReader.GetSkillAreaConfigInfo(skillId);
            Quaternion      rt          = Quaternion.LookRotation(dir);

            obj.transform.rotation = rt;
            obj.transform.position = fixPosition;
        }
Ejemplo n.º 2
0
        public AreaEffect CreateAreaEffect(UInt64 owner, uint skillId, UInt32 id, Vector3 skillDir, Vector3 skillPos)
        {
            SkillAreaConfig skillConfig = ConfigReader.GetSkillAreaConfigInfo(skillId);

            if (skillConfig == null || skillConfig.effect == "0")
            {
                return(null);
            }
            string     resourcePath = GameConfig.SkillEffectPath + skillConfig.effect;
            AreaEffect effect       = new AreaEffect();

            effect.skillId     = skillId;
            effect.dir         = skillDir;
            effect.fixPosition = skillPos;
            effect.ID          = id;
            effect.resPath     = resourcePath;
            effect.Create();
            // 播放声音
            string soundPath = GameConfig.SoundPath + skillConfig.sound;

            effect.mAudioSource = AudioUtil.PlaySound(soundPath);
            AddEffect(effect.ID, effect);
            return(effect);
        }
Ejemplo n.º 3
0
        public static Dictionary <uint, SkillAreaConfig> Read(string xmlFilePath)
        {
            Dictionary <uint, SkillAreaConfig> dic = new Dictionary <uint, SkillAreaConfig>();
            ResourceUnit unit    = ResourceManager.Instance.LoadImmediate(xmlFilePath, EResourceType.ASSET);
            TextAsset    xmlFile = unit.Asset as TextAsset;

            if (!xmlFile)
            {
                DebugEx.LogError("no xml file");
            }
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xmlFile.text);
            XmlNodeList infoNodeList = doc.SelectSingleNode("SkillCfg_area").ChildNodes;

            for (int i = 0; i < infoNodeList.Count; i++)
            {
                if ((infoNodeList[i] as XmlElement).GetAttributeNode("un32ID") == null)
                {
                    continue;
                }
                string          typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("un32ID").InnerText;
                SkillAreaConfig info     = new SkillAreaConfig();
                info.id = Convert.ToUInt32(typeName);

                foreach (XmlElement xEle in infoNodeList[i].ChildNodes)
                {
                    switch (xEle.Name)
                    {
                        #region 搜索
                    case "szName:":
                    {
                        info.name = Convert.ToString(xEle.InnerText);
                    }
                    break;

                    case "eLifeTime":
                    {
                        info.lifeTime = Convert.ToInt32(xEle.InnerText);
                    }
                    break;

                    case "attackEffect":
                    {
                        info.effect = Convert.ToString(xEle.InnerText);
                    }
                    break;

                    case "FlySound":
                    {
                        info.sound = Convert.ToString(xEle.InnerText);
                    }
                    break;

                    case "eAoeType":
                    {
                        info.aoeType = Convert.ToInt32(xEle.InnerText);
                    }
                    break;
                        #endregion
                    }
                }
                dic.Add(info.id, info);
            }
            return(dic);
        }