public void SetAbsorbMonster(int monsterID, int slot)//slot 0 ,1 { NpcConfigInfo npcInfo = ConfigReader.GetNpcInfo((int)monsterID); int skillId = 0; bool effect = true; string spriteName = ""; if (AbsorbMonsterType[slot] != monsterID && npcInfo != null) { skillId = (slot == 0) ? npcInfo.NpcSkillType3 : npcInfo.NpcSkillType4; effect = false; spriteName = npcInfo.HeadPhoto.ToString(); } else { if (AbsorbMonsterType[slot] == monsterID && monsterID != 0) { return; } } SetBaseSkillType((SkillType.SKILL_TYPEABSORB1 + slot), skillId); //set absorb skill SetAbsorbEffect(slot, effect); //set absorb btn effect AbsorbMonsterType[slot] = monsterID; //set absorb monster id EventCenter.Broadcast <int, string, bool>(EGameEvent.eGameEvent_AbsorbResult, slot, spriteName, effect); }
public virtual void IsXueTiaoCpVib(bool isVis) { if (labelCost == null) { return; } if (isVis) { NpcConfigInfo info = ConfigReader.GetNpcInfo(xueTiaoOwner.NpcGUIDType); int cp = (int)info.NpcConsumeCp; if (info.NpcCanControl == CanControl) { if (!xueTiaoOwner.IsSameCamp(PlayerManager.Instance.LocalPlayer.EntityCamp) && (xueTiaoOwner.entityType == EntityType.AltarSoldier || xueTiaoOwner.entityType == EntityType.Soldier)) { cp *= 2; } if (info.NpcType != (int)EntityType.Player || info.NpcType != (int)EntityType.Building) { labelCost.text = "CP " + cp.ToString(); } } } labelCost.gameObject.SetActive(isVis); }
void SetAbsVis(Iplayer player, int skillID, int slot) { if (skillID == 0) { skillDic[player].RemoveSkillInofDate(slot); if (UIViewerPersonInfo.Instance.SetCurrClickPlayer == player) { InfoPlayerSkill(player); } return; } NpcConfigInfo npcCfg = ConfigReader.GetNpcInfo(skillID); if (npcCfg == null) { return; } SkillManagerConfig skillCfg = ConfigReader.GetSkillManagerCfg(npcCfg.NpcSkillType2); if (skillCfg == null) { return; } skillDic[player].AddSkillInfoDate(skillCfg.id, slot, npcCfg.HeadPhoto.ToString(), skillCfg.coolDown / 1000, 0, true); }
//设置公共属性 public override void SetCommonProperty(IEntity entity, int id) { base.SetCommonProperty(entity, id); NpcConfigInfo info = ConfigReader.GetNpcInfo(id); entity.ColliderRadius = info.NpcCollideRadius / 100; entity.NPCCateChild = (NPCCateChildEnum)info.ENPCCateChild; entity.mCanBeLocked = info.CanLock; }
private void UpdateLockHead(Ientity entity) { bool mCanAbsorb = false; if (entity == null)//如果实体销毁为空了 { CurrLockEntity = null; mLockRoot.localPosition = new Vector3(5000, 0, 0); //显示的头像位置重新设定 ShowLockEffect(false); //隐藏锁定特效 EventCenter.Broadcast <string>((Int32)GameEventEnum.GameEvent_ResetLockHead, null); } else { string head = ""; CurrLockEntity = entity; spriteLockBg2.gameObject.SetActive(false); if (entity.entityType == EntityType.Player)//如果锁定的敌方英雄 { HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(entity.NpcGUIDType); head = info.HeroSelectHead.ToString(); } else //野怪,士兵,箭塔士兵 { NpcConfigInfo info = ConfigReader.GetNpcInfo(entity.NpcGUIDType); head = info.HeadPhoto.ToString(); if (entity.entityType == EntityType.Monster || entity.entityType == EntityType.Soldier || entity.entityType == EntityType.AltarSoldier && !PlayerManager.Instance.IsLocalSameType(entity)) { if (entity.BloodBar != null) { entity.BloodBar.IsBloodBarCpVib(true);//显示血条,cp() } Iselfplayer player = PlayerManager.Instance.LocalPlayer; //此目标与玩家吸收的野怪类型都不同,那么就允许吸收 if (player != null && player.AbsorbMonsterType[0] != entity.NpcGUIDType && player.AbsorbMonsterType[1] != entity.NpcGUIDType) { //目标是小野怪或者大野怪或者践踏士兵 并且和玩家不是一个阵营的, if (entity.NPCCateChild == ENPCCateChild.eNPCChild_SmallMonster || entity.NPCCateChild == ENPCCateChild.eNPCChild_HugeMonster || entity.entityType == EntityType.AltarSoldier && !PlayerManager.Instance.IsLocalSameType(entity)) { spriteLockBg2.gameObject.SetActive(true); //显示锁定头像 mCanAbsorb = true; //设置可以吸收 } } } } spriteLockHp.fillAmount = entity.Hp / entity.HpMax; //锁定头像的HP(左) spriteLockMp.fillAmount = entity.Mp / entity.MpMax; //锁定头像的MP(左) EventCenter.Broadcast <string>((Int32)GameEventEnum.GameEvent_ResetLockHead, head); spriteLock.spriteName = head; //锁定的头像(左) mLockRoot.localPosition = mLockPos; //根节点的本地位置 ShowLockEffect(true); //显示锁定特效 EventCenter.Broadcast <GameObject>((mCanAbsorb) ? (Int32)GameEventEnum.GameEvent_GuideLockTargetCanAbsorb : (Int32)GameEventEnum.GameEvent_GuideLockTargetCanNotAbsorb, spriteLockBg2.gameObject); } }
private void UpdateLockHead(Ientity entity) { bool mCanAbsorb = false; if (entity == null) { CurrLockEntity = null; mLockRoot.localPosition = new Vector3(5000, 0, 0); ShowLockEffect(false); EventCenter.Broadcast <string>(EGameEvent.eGameEvent_ResetLockHead, null); } else { string head = ""; CurrLockEntity = entity; spriteLockBg2.gameObject.SetActive(false); if (entity.entityType == EntityType.Player) { HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(entity.NpcGUIDType); head = info.HeroSelectHead.ToString(); } else { NpcConfigInfo info = ConfigReader.GetNpcInfo(entity.NpcGUIDType); head = info.HeadPhoto.ToString(); if (entity.entityType == EntityType.Monster || entity.entityType == EntityType.Soldier || entity.entityType == EntityType.AltarSoldier && !PlayerManager.Instance.IsLocalSameType(entity)) { if (entity.XueTiao != null) { entity.XueTiao.IsXueTiaoCpVib(true); } Iselfplayer player = PlayerManager.Instance.LocalPlayer; if (player != null && player.AbsorbMonsterType[0] != entity.NpcGUIDType && player.AbsorbMonsterType[1] != entity.NpcGUIDType) { if (entity.NPCCateChild == ENPCCateChild.eNPCChild_SmallMonster || entity.NPCCateChild == ENPCCateChild.eNPCChild_HugeMonster || entity.entityType == EntityType.AltarSoldier && !PlayerManager.Instance.IsLocalSameType(entity)) { spriteLockBg2.gameObject.SetActive(true); mCanAbsorb = true; } } } } spriteLockHp.fillAmount = entity.Hp / entity.HpMax; spriteLockMp.fillAmount = entity.Mp / entity.MpMax; EventCenter.Broadcast <string>(EGameEvent.eGameEvent_ResetLockHead, head); spriteLock.spriteName = head; mLockRoot.localPosition = mLockPos; ShowLockEffect(true); EventCenter.Broadcast <GameObject>((mCanAbsorb) ? EGameEvent.eGameEvent_GuideLockTargetCanAbsorb : EGameEvent.eGameEvent_GuideLockTargetCanNotAbsorb, spriteLockBg2.gameObject); } }
public void SetJungleMonsterBeAtkVoice() { int id = (int)ObjTypeID; NpcConfigInfo info = ConfigReader.GetNpcInfo(id); if (entityType != EntityType.Monster || Hp < hpLimit || AudioManager.Instance.HeroLinesAudioDict.ContainsKey(GameObjGUID)) { return; } List <float> ifPlaySoundList = new List <float>(); for (int i = 0; i < ifPlayMonsterSound.Length; i++) { ifPlaySoundList.Add(ifPlayMonsterSound[i]); } int indexPlay = GameMethod.RandProbablityIndex(ifPlaySoundList);//获得是否播放下标 if (indexPlay == 1) { return; } if (HasSameTypeNpcPlaySoundIsPlaying()) { return; } if (info.n32Script1Rate == null) { return; } List <float> probabilityList = GameMethod.ResolveToFloatList(info.n32Script1Rate);//获得概率集合 for (int i = 0; i < probabilityList.Count; i++) { probabilityList[i] = (float)(probabilityList[i] - 90000) / 100f; } int index = GameMethod.RandProbablityIndex(probabilityList); //获得概率下标 List <string> voiceList = GameMethod.ResolveToStrList(info.un32Script1); string name = voiceList[index]; //获得概率下标对应的声音 string path = AudioDefine.PATH_JUNGLE_MONSTER_BE_ATK_SOUND + name; //AudioClip clip = Resources.Load(path) as AudioClip; ResourceItem clipUnit = ResourcesManager.Instance.loadImmediate(path, ResourceType.ASSET); AudioClip clip = clipUnit.Asset as AudioClip; AudioManager.Instance.PlayHeroLinesAudio(GameObjGUID, clip); }
public override void SetXueTiaoInfo() { base.SetXueTiaoInfo(); NpcConfigInfo info = ConfigReader.GetNpcInfo(xueTiaoOwner.NpcGUIDType); if (info.NpcCanControl == CanControl) { int cp = (int)info.NpcConsumeCp; labelCost.text = "CP "+ cp.ToString(); labelCost.gameObject.SetActive(true); } else { labelCost.gameObject.SetActive(false); } }
public void SendAbsortMonster() { if (SyncLockTarget == null) { //显示消息 “您还没有目标” MsgInfoManager.Instance.ShowMsg((int)ErrorTypeEnum.NeedLockTarget); return; } if (SyncLockTarget.entityType == EntityTypeEnum.Building || SyncLockTarget.entityType == EntityTypeEnum.Player || SyncLockTarget.entityType == EntityTypeEnum.Soldier) { // 显示消息 “目标不能被吸附” MsgInfoManager.Instance.ShowMsg(-130956); return; } NpcConfigInfo info = ConfigReader.GetNpcInfo(SyncLockTarget.NpcGUIDType); if (info == null) { return; } //目标是否可以被吸附 0:不可以 1:可以 int isLock = info.NpcCanControl; if (IsAbsobing == true) { return; //如果正在吸附,返回。 } // 有两个附身对象 等级在7级以上,目标与第一个和第二个类型不同,目标允许吸附 if (AbsorbMonsterType[0] != 0 && AbsorbMonsterType[1] != 0 && Level >= absBigLevel && (AbsorbMonsterType[1] != SyncLockTarget.NpcGUIDType && AbsorbMonsterType[0] != SyncLockTarget.NpcGUIDType) && isLock != 0) { CreateSoleSoldier();//创建灵魂交换面板 return; } // 有一个附身对象 英雄等级在3到7级之间 目标允许吸附 if (AbsorbMonsterType[0] != 0 && Level >= absSmallLevel && AbsorbMonsterType[0] != SyncLockTarget.NpcGUIDType && isLock != 0 && AbsorbMonsterType[1] == 0 && AbsorbMonsterType[1] != SyncLockTarget.NpcGUIDType && Level < absBigLevel) { CreateSoleSoldier();//创建灵魂交换面板 return; } int npcType = -1; HolyGameLogic.Instance.EmsgToss_AskAbsorb(npcType);//通知服务器请求吸附 }
void ResetAbsHead(int newMonsterID1, int newMonsterID2) { //注释更新头相 NpcConfigInfo info = ConfigReader.GetNpcInfo(newMonsterID1); if (info != null) { AltarHeadPhoto[1].spriteName = info.HeadPhoto.ToString(); } info = ConfigReader.GetNpcInfo(newMonsterID2); if (info != null) { AltarHeadPhoto[2].spriteName = info.HeadPhoto.ToString(); } if (this != null) { DestroySole(); } }
protected override float GetXueTiaoHeight() { HeroConfigInfo info = null; if ((SceneGuideTaskManager.Instance().IsNewsGuide() != SceneGuideTaskManager.SceneGuideType.NoGuide) && (xueTiaoOwner.entityType == EntityType.Soldier || xueTiaoOwner.entityType == EntityType.AltarSoldier)) { NpcConfigInfo nInfo = ConfigReader.GetNpcInfo(xueTiaoOwner.NpcGUIDType); ShowGuideXueTiaoInfo(); return(nInfo.NpcXueTiaoHeight); } else { info = ConfigReader.GetHeroInfo(xueTiaoOwner.NpcGUIDType); } return(info.HeroXueTiaoHeight); }
public virtual void InitWhenCreateModel() { int id = (int)ObjTypeID; if (this.entityType != EntityType.Player) { RealEntity.SetAttackAnimationLoop(true); } NpcConfigInfo npcInfo = ConfigReader.GetNpcInfo(id); AtkSpeed = npcInfo.NpcAttackSpeed; if (AtkSpeed != 0) { float spd = 1 / (AtkSpeed / 1000.0f); RealEntity.SetAttackAnimationSpd(spd); } else { RealEntity.SetAttackAnimationSpd(1.0f); } }
public void SendAbsortMonster() { if (SyncLockTarget == null) { MsgInfoManager.Instance.ShowMsg((int)ERROR_TYPE.eT_NeedLockTarget); return; } if (SyncLockTarget.entityType == EntityType.Building || SyncLockTarget.entityType == EntityType.Player || SyncLockTarget.entityType == EntityType.Soldier) { MsgInfoManager.Instance.ShowMsg(-130956); return; } NpcConfigInfo info = ConfigReader.GetNpcInfo(SyncLockTarget.NpcGUIDType); if (info == null) { return; } int isLock = info.NpcCanControl; if (IsAbsobing == true) { return; } if (AbsorbMonsterType[0] != 0 && AbsorbMonsterType[1] != 0 && Level >= absBigLevel && (AbsorbMonsterType[1] != SyncLockTarget.NpcGUIDType && AbsorbMonsterType[0] != SyncLockTarget.NpcGUIDType) && isLock != 0) { CreateSoleSoldier(); return; } if (AbsorbMonsterType[0] != 0 && Level >= absSmallLevel && AbsorbMonsterType[0] != SyncLockTarget.NpcGUIDType && isLock != 0 && AbsorbMonsterType[1] == 0 && AbsorbMonsterType[1] != SyncLockTarget.NpcGUIDType && Level < absBigLevel) { CreateSoleSoldier(); return; } int npcType = -1; CGLCtrl_GameLogic.Instance.EmsgToss_AskAbsorb(npcType); }
protected virtual float GetXueTiaoHeight() { NpcConfigInfo info = ConfigReader.GetNpcInfo(xueTiaoOwner.NpcGUIDType); return(info.NpcXueTiaoHeight); }
public ReadNpcConfig(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("NPCCfg ").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; NpcConfigInfo NpcSelectInfo = new NpcConfigInfo(); NpcSelectInfo.NpcId = Convert.ToInt32(typeName); foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { #region 搜索 switch (xEle.Name) { case "szNOStr": NpcSelectInfo.NpcName = Convert.ToString(xEle.InnerText); break; case "eNpcType": NpcSelectInfo.NpcType = Convert.ToInt32(xEle.InnerText); break; case "eNpcChildType": NpcSelectInfo.ENPCCateChild = Convert.ToInt32(xEle.InnerText); break; case "XuetiaoHeight": NpcSelectInfo.NpcXueTiaoHeight = Convert.ToSingle(xEle.InnerText); break; case "eRace": NpcSelectInfo.NpcRace = Convert.ToInt32(xEle.InnerText); break; case "eAttendantCate": NpcSelectInfo.NpcAttendantCate = Convert.ToInt32(xEle.InnerText); break; case "eMagicCate": NpcSelectInfo.NpcMagicCate = Convert.ToInt32(xEle.InnerText); break; case "n32AttackDist": NpcSelectInfo.NpcAtkDis = Convert.ToSingle(xEle.InnerText); break; case "eAICate": NpcSelectInfo.NpcAiCate = Convert.ToInt32(xEle.InnerText); break; case "un32AITarID": NpcSelectInfo.NpcAiTarId = Convert.ToInt32(xEle.InnerText); break; case "n32PursueDist": NpcSelectInfo.NpcPursueDis = Convert.ToSingle(xEle.InnerText); break; case "n32GuardDist": NpcSelectInfo.NpcGuardDis = Convert.ToSingle(xEle.InnerText); break; case "eAttackMode": NpcSelectInfo.NpcAtkMode = Convert.ToInt32(xEle.InnerText); break; case "n32AttackPower": NpcSelectInfo.NpcAtkPower = Convert.ToSingle(xEle.InnerText); break; case "n32MagAttackPower": NpcSelectInfo.NpcMagAtkPower = Convert.ToSingle(xEle.InnerText); break; case "n32DefenseAbility": NpcSelectInfo.NpcDef = Convert.ToSingle(xEle.InnerText); break; case "n32MagDefenseAbility": NpcSelectInfo.NpcMagDef = Convert.ToSingle(xEle.InnerText); break; case "n32MoveSpeed": NpcSelectInfo.NpcMoveSpeed = Convert.ToSingle(xEle.InnerText); break; case "n32BaseMoveSpeedScaling": NpcSelectInfo.n32BaseMoveSpeedScaling = Convert.ToSingle(xEle.InnerText); break; case "n32AttackCD": NpcSelectInfo.NpcAtkCd = Convert.ToSingle(xEle.InnerText); break; case "n32MaxHP": NpcSelectInfo.NpcMaxHp = Convert.ToSingle(xEle.InnerText); break; case "n32MaxMP": NpcSelectInfo.NpcMaxMp = Convert.ToSingle(xEle.InnerText); break; case "n32GotExp": NpcSelectInfo.NpcGotExp = Convert.ToSingle(xEle.InnerText); break; case "n32ConsumeCP": NpcSelectInfo.NpcConsumeCp = Convert.ToSingle(xEle.InnerText); break; case "n32KillCP": NpcSelectInfo.NpcKillCp = Convert.ToSingle(xEle.InnerText); break; case "bIfCanControl": NpcSelectInfo.NpcCanControl = Convert.ToInt32(xEle.InnerText); break; case "n32HPRecover": NpcSelectInfo.NpcHpRecover = Convert.ToSingle(xEle.InnerText); break; case "n32MPRecover": NpcSelectInfo.NpcMpRecover = Convert.ToSingle(xEle.InnerText); break; case "n32CollideRadius": NpcSelectInfo.NpcCollideRadius = Convert.ToSingle(xEle.InnerText); break; case "un32WalkSound": NpcSelectInfo.NpcWalkSound = Convert.ToString(xEle.InnerText); break; case "un32DeathSould": NpcSelectInfo.NpcDeathSould = Convert.ToString(xEle.InnerText); break; case "un32SkillType1": NpcSelectInfo.NpcSkillType1 = Convert.ToInt32(xEle.InnerText); break; case "un32SkillType2": NpcSelectInfo.NpcSkillType2 = Convert.ToInt32(xEle.InnerText); break; case "un32SkillType3": NpcSelectInfo.NpcSkillType3 = Convert.ToInt32(xEle.InnerText); break; case "un32SkillType4": NpcSelectInfo.NpcSkillType4 = Convert.ToInt32(xEle.InnerText); break; case "un32SkillType5": NpcSelectInfo.NpcSkillType5 = Convert.ToInt32(xEle.InnerText); break; case "HeadPhoto": NpcSelectInfo.HeadPhoto = Convert.ToInt32(xEle.InnerText); break; case "eCamp": NpcSelectInfo.NpcCamp = Convert.ToInt32(xEle.InnerText); break; case "un32ShopID": NpcSelectInfo.un32ShopID = Convert.ToInt32(xEle.InnerText); break; case "BuildsDeathEffID": NpcSelectInfo.NpcJianTaDeath = Convert.ToString(xEle.InnerText); break; case "n32LockRadius": NpcSelectInfo.n32LockRadius = Convert.ToSingle(xEle.InnerText); break; case "n32Script1Rate": NpcSelectInfo.n32Script1Rate = Convert.ToString(xEle.InnerText); break; case "un32Script1": NpcSelectInfo.un32Script1 = Convert.ToString(xEle.InnerText); break; case "n32AttackSpeed": NpcSelectInfo.NpcAttackSpeed = Convert.ToInt32(xEle.InnerText); break; case "n32IsLocked": NpcSelectInfo.CanLock = (Convert.ToInt32(xEle.InnerText) == 1) ? true : false; break; } #endregion } ConfigReader.npcXmlInfoDict.Add(NpcSelectInfo.NpcId, NpcSelectInfo); } }