Example #1
0
        //8.创建技能范围特效
        public SkillAreaEffect CreateAreaEffect(UInt64 owner, uint skillID, UInt32 projectId, Vector3 skillDir, Vector3 skillPos)
        {
            SkillAreaConfig skillConfig = ConfigReader.GetSkillAreaConfig(skillID);

            //判断路径是否有效
            if (skillConfig == null || skillConfig.effect == "0")
            {
                return(null);
            }

            string resourcePath = GameConstDefine.LoadGameSkillEffectPath + "release/" + skillConfig.effect;

            SkillAreaEffect effect = new SkillAreaEffect();

            effect.skillID     = skillID;
            effect.dir         = skillDir;
            effect.fixPosition = skillPos;
            effect.projectID   = projectId;


            effect.resPath   = resourcePath;
            effect.cehuaTime = skillConfig.lifeTime;

            //创建
            effect.Create();

            //播放声音
            string soundPath = GameConstDefine.LoadGameSoundPath + skillConfig.sound;

            PlayAudio(effect, soundPath, effect.obj);

            AddEffect(effect.projectID, effect);
            return(effect);
        }
Example #2
0
        public override void OnLoadComplete()
        {
            SkillAreaConfig skillInfo = ConfigReader.GetSkillAreaConfig(skillID);
            Quaternion      rt        = Quaternion.LookRotation(dir);

            GetTransform().rotation = rt;
            GetTransform().position = fixPosition;
        }
        public string getAreaEffectPath(uint id)
        {
            SkillAreaConfig skillConfig = ConfigReader.GetSkillAreaConfig(id);

            //判断路径是否有效
            if (skillConfig == null || skillConfig.effect == "0")
            {
                return(null);
            }

            return(GameConstDefine.LoadGameSkillEffectPath + "release/" + skillConfig.effect);
        }
        private void tryCacehAllObject(int objTypeId)
        {
            string ModelName = EntityManager.Instance.CacheGetModeName(objTypeId);
            string path      = GameDefine.GameConstDefine.LoadMonsterModels;

            HeroConfigInfo hcfg = ConfigReader.GetHeroInfo(objTypeId);
            int            skill1 = 0, skill2 = 0, skill3 = 0, skill4 = 0;

            if (hcfg != null)
            {
                skill1 = hcfg.HeroSkillType1;
                skill2 = hcfg.HeroSkillType2;
                skill3 = hcfg.HeroSkillType3;                //1's prower skill
                skill4 = hcfg.HeroSkillType4;
            }

            //所有技能(GetPrepareSkill, 也可能是物品skill)
            string     resourcePath;
            GameObject obj;

            if (skill1 != 0)
            {
                //SkillConfigInfo info = ConfigReader.GetSkillInfo(skill1);
                SkillManagerConfig info = ConfigReader.GetSkillManagerCfg(skill1);

                SkillConfigInfo skillInfo = ConfigReader.GetSkillInfo((uint)skill1);
                resourcePath = GameConstDefine.LoadGameBuffEffectPath + info.EventID;

                SkillAreaConfig skillConfig = ConfigReader.GetSkillAreaConfig((uint)skill1);
                //判断路径是否有效
                if (skillConfig != null && skillConfig.effect != "0")
                {
                    resourcePath = GameConstDefine.LoadGameSkillEffectPath + "release/" + skillConfig.effect;
                    obj          = GameObjectPool.Instance.GetGO(resourcePath);
                    //return null;
                }

                string buffPath = EffectManager.Instance.GetBuffEffectPath((uint)skill1);
                //eventid可能等于0
                string flyPath = EffectManager.Instance.getFlyEffectPath(info.EventID);                //131010
                obj = GameObjectPool.Instance.GetGO(flyPath);

                //string templateName = ResourceCommon.getResourceName(resourcePath);
            }

            //创建GameObject
            string resPath = ModelName;
            //GameObject realObject = GameObjectPool.Instance.GetGO(resPath);
            //以下资源根据客户端cfg获得,所以也是存在和服务器返回有出入的可能性
            //所有状态
        }
        public override void OnLoadComplete()
        {
            //Ientity enOwner;
            //EntityManager.AllEntitys.TryGetValue(enOwnerKey, out enOwner);

            //if (enOwner == null || obj == null)
            //{
            //    isDead = true;
            //    return;
            //}
            SkillAreaConfig skillInfo = ConfigReader.GetSkillAreaConfig(skillID);
            Quaternion rt = Quaternion.LookRotation(dir);
            GetTransform().rotation = rt;
            GetTransform().position = fixPosition;           
        }
        //8.创建技能范围特效
        public SkillAreaEffect CreateAreaEffect(UInt64 owner, uint skillID, UInt32 projectId, Vector3 skillDir, Vector3 skillPos)
        {
            SkillAreaConfig skillConfig = ConfigReader.GetSkillAreaConfig(skillID);

            //判断路径是否有效
            if (skillConfig == null || skillConfig.effect == "0")
            {
                return(null);
            }

            string resourcePath = GameConstDefine.LoadGameSkillEffectPath + "release/" + skillConfig.effect;

            SkillAreaEffect effect = new SkillAreaEffect();

            //加载特效信息
            //Ientity entityOwner;
            //EntityManager.AllEntitys.TryGetValue(owner, out entityOwner);
            //if (entityOwner == null)
            //{
            //    //Debug.LogError("CreateAreaEffect  entityOwner is null");
            //    //return null;
            //}
            //effect.enOwnerKey = entityOwner.GameObjGUID;
            effect.skillID     = skillID;
            effect.dir         = skillDir;
            effect.fixPosition = skillPos;
            effect.projectID   = projectId;


            effect.resPath   = resourcePath;
            effect.cehuaTime = skillConfig.lifeTime;

            //创建
            effect.Create();
            //return effect;
            //下面的代码有个stringtoconsole损耗
            //播放声音
            string soundPath = GameConstDefine.LoadGameSoundPath + skillConfig.sound;

            PlayAudio(effect, soundPath, effect.obj);

            AddEffect(effect.projectID, effect);
            return(effect);
        }
Example #7
0
    public ReadSkillAreaConfig(string xmlFilePath)
    {
        //TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset;
        ResourceItem xmlfileUnit = ResourcesManager.Instance.loadImmediate(xmlFilePath, ResourceType.ASSET);
        TextAsset    xmlfile     = xmlfileUnit.Asset as TextAsset;

        if (!xmlfile)
        {
            //Debug.LogError(" error infos: 没有找到指定的xml文件:" + xmlFilePath);
        }

        xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(xmlfile.text);

        XmlNodeList infoNodeList = xmlDoc.SelectSingleNode("SkillCfg_area ").ChildNodes;

        for (int i = 0; i < infoNodeList.Count; i++)
        {//(XmlNode xNode in infoNodeList)
            if ((infoNodeList[i] as XmlElement).GetAttributeNode("un32ID") == null)
            {
                continue;
            }

            string typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("un32ID").InnerText;
            //Debug.LogError(typeName);
            SkillAreaConfig skillinfo = new SkillAreaConfig();
            skillinfo.id = Convert.ToUInt32(typeName);

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

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

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

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

                case "eAoeType":
                {
                    skillinfo.aoeType = Convert.ToInt32(xEle.InnerText);
                }
                break;
                    #endregion
                }
            }
            ConfigReader.skillAreaInfoDic.Add(skillinfo.id, skillinfo);
        }
    }