Ejemplo n.º 1
0
        private void OnWarningEvent(UInt64 ownerId, uint skillID, UInt64 targetID)
        {
            SkillAccountConfig skillAccConfig = ConfigReader.GetSkillAccountCfg(skillID);

            if (skillAccConfig == null || !skillAccConfig.isDmgEffect)
            {
                return;
            }
            if (!EntityManager.AllEntitys.ContainsKey(targetID))
            {
                return;
            }
            Ientity entity = EntityManager.AllEntitys[targetID];

            if (PlayerManager.Instance.LocalPlayer == null)
            {
                return;
            }
            if (!entity.IsSameCamp(PlayerManager.Instance.LocalPlayer.EntityCamp))
            {
                return;
            }
            if (entity == null || entity.realObject == null || !entity.realObject.activeInHierarchy)
            {
                return;
            }
            if (entity.entityType != EntityType.Building && entity.entityType != EntityType.Player)
            {
                if (SceneGuideTaskManager.Instance().IsNewsGuide() == SceneGuideTaskManager.SceneGuideType.NoGuide)
                {
                    return;
                }
                else
                {
                    if (entity.NpcGUIDType != 21017)//新手引导己方精灵女
                    {
                        return;
                    }
                }
            }
            AddMapWarning(targetID);
            AddBuildingWarningVoice(targetID);
        }
Ejemplo n.º 2
0
        //7.创建受击特效
        public BeAttackEffect CreateBeAttackEffect(UInt64 owner, UInt64 target, uint skillID)
        {
            SkillAccountConfig skillAccConfig = ConfigReader.GetSkillAccountCfg(skillID);

            //判断是否有后续屏幕振动效果
            if (skillAccConfig != null && skillAccConfig.cameraId != 0)
            {
                //振动类型1 释放为本机振动  2受机为本机振动
                bool shakeFlag = false;
                if (skillAccConfig.cameraTarget == 1)
                {
                    Ientity ownerEntity = null;
                    EntityManager.AllEntitys.TryGetValue(owner, out ownerEntity);

                    if (ownerEntity != null && ownerEntity is Iselfplayer)
                    {
                        shakeFlag = true;
                    }
                }
                else if (skillAccConfig.cameraTarget == 2)
                {
                    Ientity targetEntity = null;
                    EntityManager.AllEntitys.TryGetValue(target, out targetEntity);

                    if (targetEntity != null && targetEntity is Iselfplayer)
                    {
                        shakeFlag = true;
                    }
                }
                else if (skillAccConfig.cameraTarget == 3)
                {
                    Ientity ownerEntity  = null;
                    Ientity targetEntity = null;
                    EntityManager.AllEntitys.TryGetValue(owner, out ownerEntity);
                    EntityManager.AllEntitys.TryGetValue(target, out targetEntity);

                    if ((ownerEntity != null && ownerEntity is Iselfplayer) || targetEntity != null && targetEntity is Iselfplayer)
                    {
                        shakeFlag = true;
                    }
                }

                if (shakeFlag)
                {
                    //获屏幕振动信息
                    SkillCameraConfig skillCameracfg = ConfigReader.GetSkillCameraConfig(skillAccConfig.cameraId);
                    if (skillCameracfg != null)
                    {
                        //被击飞信息
                        float period      = skillCameracfg.mPeriod;
                        float offPeriod   = skillCameracfg.mOffPeriod;
                        int   shakeOrient = skillCameracfg.mShakeOrient;
                        float shakeTime   = skillCameracfg.mShakeTime;
                        float maxWave     = skillCameracfg.mMaxWave;
                        float minWave     = skillCameracfg.mMinWave;

                        Shakecamera(period, offPeriod, shakeOrient, shakeTime, maxWave, minWave);
                    }
                }
            }


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


            //加载特效信息
            Ientity entityOwner, entityTarget;

            EntityManager.AllEntitys.TryGetValue(owner, out entityOwner);
            EntityManager.AllEntitys.TryGetValue(target, out entityTarget);

            //根据受击特效跟玩家距离判断是否需要创建特效
            if (entityTarget != null)
            {
                if (!CheckEffectValid(entityTarget.objTransform.position, skillAccConfig.lifeTime))
                {
                    return(null);
                }
            }

            string         resourcePath = GameConstDefine.LoadGameSkillEffectPath + "hit/" + skillAccConfig.effect;
            BeAttackEffect effect       = new BeAttackEffect();

            if (entityTarget != null)
            {
                effect.enTargetKey = entityTarget.GameObjGUID;
            }

            if (entityOwner == null)
            {
                return(null);
            }

            effect.enOwnerKey = entityOwner.GameObjGUID;

            effect.skillID   = skillID;
            effect.resPath   = resourcePath;
            effect.cehuaTime = skillAccConfig.lifeTime;

            //创建
            effect.Create();
            //播放声音
            string soundPath = GameConstDefine.LoadGameSoundPath + skillAccConfig.sound;

            if (skillAccConfig.sound != "0")
            {
                PlayAudio(effect, soundPath, effect.obj);
            }

            AddEffect(effect.projectID, effect);
            return(effect);
        }
Ejemplo n.º 3
0
    public ReadSkillAccountConfig(string xmlFilePath)
    {
        //TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset;
        ResourceUnit 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_account ").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);
            SkillAccountConfig skillinfo = new SkillAccountConfig();
            skillinfo.id = Convert.ToUInt32(typeName);

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

                //case "EmitType":
                //    {
                //        skillinfo.emitType = Convert.ToInt32(xEle.InnerText);
                //    }
                //    break;
                //case "FlySpeed":
                //    {
                //        skillinfo.flySpeed = Convert.ToInt32(xEle.InnerText) / 100.0f;
                //    }
                //    break;
                case "woundEffect":
                {
                    skillinfo.effect = Convert.ToString(xEle.InnerText);
                }
                break;

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

                case "WEffectTime":
                {
                    skillinfo.lifeTime = Convert.ToInt32(xEle.InnerText) / 1000.0f;
                }
                break;

                case "bIsHarmful":
                {
                    skillinfo.isDmgEffect = (Convert.ToInt32(xEle.InnerText) == 1) ? true : false;
                }
                break;

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

                case "CameraTarget":
                {
                    skillinfo.cameraTarget = Convert.ToInt32(xEle.InnerText);
                } break;
                    #endregion
                }
            }
            ConfigReader.skillAccountInfoDic.Add(skillinfo.id, skillinfo);
        }
    }