/// 1.英雄 > 召唤兽 > 小兵 > 防御塔 > 建筑 (英雄使用) public void SortByPriority(IEnumerable <ServerNPC> unPriority, WarServerNpcMgr npcMgr, List <List <ServerNPC> > HasPriority) { //已经排好序的 if (HasPriority == null) { HasPriority = new List <List <ServerNPC> >(); } else { HasPriority.Clear(); } for (int i = 0; i < 5; ++i) { HasPriority.Add(null); } foreach (ServerNPC npc in unPriority) { NPCConfigData cfg = npc.data.configData; ExistFlag totest = LifeNpcType2ExistFlag(cfg.type, cfg.bldType); /// /// 如果属于不关心的类型,则丢弃 /// if (totest == ExistFlag.None) { continue; } base.addNpcByPriority(npc, (byte)totest, HasPriority); } }
public void SortByPriority(IEnumerable <ServerNPC> unPriority, WarServerNpcMgr npcMgr, List <List <ServerNPC> > HasPriority) { //已经排好序的 if (HasPriority == null) { HasPriority = new List <List <ServerNPC> >(); } else { HasPriority.Clear(); } for (int i = 0; i < 8; ++i) { HasPriority.Add(null); } foreach (ServerNPC npc in unPriority) { ExistFlag toTest = ExistFlag.None; /// /// 挑选出关心的 敌方英雄,敌方召唤物, 敌方小兵 /// NPCConfigData cfg = npc.data.configData; bool careHero = cfg.type.check(LifeNPCType.Hero); bool careSummoner = cfg.type.check(LifeNPCType.Summon); bool careMinion = cfg.type.check(LifeNPCType.Soldier); bool careBuilding = cfg.type.check(LifeNPCType.Build); bool care = careHero || careSummoner || careMinion || careBuilding; if (care == false) { continue; } if (careHero) { toTest = NPCToFlag(npc, npcMgr, LifeNPCType.Hero); } if (careSummoner) { toTest = NPCToFlag(npc, npcMgr, LifeNPCType.Summon); } if (careMinion) { toTest = NPCToFlag(npc, npcMgr, LifeNPCType.Soldier); } if (careBuilding) { toTest = NPCToFlag(npc, npcMgr, LifeNPCType.Build); } base.addNpcByPriority(npc, (byte)toTest, HasPriority); } }
public void SortByPriority(IEnumerable <ServerNPC> unPriority, WarServerNpcMgr npcMgr, List <List <ServerNPC> > HasPriority) { //已经排好序的 if (HasPriority == null) { HasPriority = new List <List <ServerNPC> >(); } else { HasPriority.Clear(); } for (int i = 0; i < 6; ++i) { HasPriority.Add(null); } foreach (ServerNPC npc in unPriority) { ExistFlag toTest = toExistType(npc, npcMgr); base.addNpcByPriority(npc, (byte)toTest, HasPriority); } }