/// <summary> /// 按类型取得lifeM列表,支持组合类型 /// </summary> private static List <SceneSoldier> GetLifeMList(LifeMType Type) { List <SceneSoldier> l = new List <SceneSoldier>(); if ((Type & LifeMType.SOLDIER) != 0) { l.AddRange(m_SoldierList); } if ((Type & LifeMType.BUILD) != 0) { l.AddRange(m_BuildList); } if ((Type & LifeMType.PET) != 0) { l.AddRange(m_PetList); } if ((Type & LifeMType.SUMMONPET) != 0) { l.AddRange(m_SummonPetList); } if ((Type & LifeMType.WALL) != 0) { l.AddRange(m_WallList); } if ((Type & LifeMType.FLOOR) != 0) { l.AddRange(m_FoorList); } if ((Type & LifeMType.INHERITSUMMONPROS) != 0) { l.AddRange(m_InheritSummonList); } return(l); }
public static void EmptyRoleStations(int SceneID, LifeMType Type) { if (Type == LifeMType.SOLDIER) { if (m_RoleStation.ContainsKey(SceneID) == true) { MapStations m = m_RoleStation[SceneID]; if (m != null) { if (m.EmptyStations(SceneID) == true) { AddUpRoleStation(m); } } m_RoleStation.Remove(SceneID); } } else if (Type == LifeMType.BUILD) { foreach (MapGrid m in m_lGrid) { m.RemoveBuild(SceneID); } } else if (Type == LifeMType.WALL) { foreach (MapGrid m in m_lGrid) { m.RemoveWall(SceneID); } } }
/// <summary> /// 按类型取得lifeM列表,不支持组合类型 /// </summary> private static List <SceneSoldier> GetSceneSoldierList(LifeMType Type) { if (Type == LifeMType.SOLDIER) { return(m_SoldierList); } else if (Type == LifeMType.PET) { return(m_PetList); } else if (Type == LifeMType.BUILD) { return(m_BuildList); } else if (Type == LifeMType.WALL) { return(m_WallList); } else if (Type == LifeMType.FLOOR) { return(m_FoorList); } else if (Type == LifeMType.SUMMONPET) { return(m_SummonPetList); } else if (Type == LifeMType.INHERITSUMMONPROS) { return(m_InheritSummonList); } return(null); }
public void Copy(LifeMCore s) { this.m_DataID = s.m_DataID; this.m_type = s.m_type; this.m_Camp = s.m_Camp; this.m_MoveState = s.m_MoveState; this.m_IsPlayer = s.m_IsPlayer; }
public LifeMCore(int Data, bool IsPlayer, LifeMType Type, LifeMCamp Camp, MoveState State) { this.m_DataID = Data; this.m_IsPlayer = IsPlayer; this.m_type = Type; this.m_Camp = Camp; this.m_MoveState = State; }
/// <summary> /// 判断战斗中包含某类对象,不支持组合对象 /// </summary> public static bool HaveIntanseInScene(LifeMType Type, LifeMCamp Camp, int Data) { List <SceneSoldier> l = GetSceneSoldierList(Type); if (l != null) { foreach (SceneSoldier s in l) { LifeMCore Core = s.m_Core; if (Core.m_type == Type && Core.m_Camp == Camp && Core.m_DataID == Data) { return(true); } } } return(false); }
/// <summary> /// 根据scene 及Type 取得LifeM对象, 支持混合类型 /// </summary> public static Life GetAllLifeM(int SceneID, LifeMType Type) { if (SceneID < 0) { return(null); } List <SceneSoldier> l = GetLifeMList(Type); SceneSoldier s = GetSceneSoldier(l, SceneID); if (s != null) { if (s.m_Life == null) { NGUIUtil.DebugLog("s.m_Life is null" + SceneID + "," + Type); } return(s.m_Life); } return(null); }
/// <summary> /// 满足Core条件判断 /// </summary> /// <param name="Core">不为空,则在这个列表中进行搜索,为空在所有CM管理的列表中进行搜索</param> /// <param name="Type">按指定包含的类型进行搜索</param> /// <param name="Camp">按指定的阵营</param> /// <returns>true 满足条件,false 不满足条件</returns> private static bool CheckCoreConditions(LifeMCore Core, LifeMType Type, LifeMCamp Camp) { if (Core == null) { return(false); } if ((Type & Core.m_type) == 0) { return(false); } if ((Camp & Core.m_Camp) == 0) { return(false); } else { return(true); } }
/// <summary> /// 按条件搜索lifeM /// </summary> /// <param name="HaveList">不为空,则在这个列表中进行搜索,为空在所有CM管理的列表中进行搜索</param> /// <param name="Type">lifem 类型,支持位组合</param> /// <param name="Camp">按指定的阵营,支持组合</param> /// <param name="TargetMg">格子的位置</param> /// <param name="Radius">搜索半径,圆形,球形需要</param> /// <returns>返回搜索列表list</returns> public static void SearchLifeMListByGrid(ref List <Life> list, List <Life> HaveList, LifeMType Type, LifeMCamp Camp, MapSearchStlye SearchStype, MapGrid TargetMg, float Radius) { if (list == null) { list = new List <Life> (); } else { list.Clear(); } //cm 中获取列表 if (HaveList == null || HaveList.Count == 0) { List <SceneSoldier> l = GetLifeMList(Type); if (l != null) { foreach (SceneSoldier s in l) { if (s == null) { continue; } LifeMCore Core = s.m_Core; Life life = s.m_Life; if (CheckCoreConditions(Core, Camp) == false) { continue; } if (CheckMapConditions(SearchStype, TargetMg, life, Radius) == false) { continue; } list.Add(life); } } } else //have list 中进行过滤 { foreach (Life life in HaveList) { if (life == null) { continue; } LifeMCore Core = life.m_Core; if (CheckCoreConditions(Core, Type, Camp) == false) { continue; } if (CheckMapConditions(SearchStype, TargetMg, life, Radius) == false) { continue; } list.Add(life); } } }
/// <summary> /// 搜索船上,单个类型,所有阵营 /// </summary> /// <param name="Type">按指定包含的类型进行搜索</param> /// <param name="Camp">按指定的阵营</param> /// <returns>返回搜索列表list</returns> public static void SearchLifeMListInBoat(ref List <Life> list, LifeMType Type) { SearchLifeMList(ref list, null, Type, LifeMCamp.ALL, MapSearchStlye.InBoat, null, 0.0f); }
/// <summary> /// 按条件搜索lifeM /// </summary> /// <param name="HaveList">不为空,则在这个列表中进行搜索,为空在所有CM管理的列表中进行搜索</param> /// <param name="Type">lifem 类型,支持位组合</param> /// <param name="Camp">按指定的阵营,支持组合</param> /// <param name="Target">参考目标,同层,圆形,球形搜索方式需要</param> /// <param name="SearchInfo">搜索参数</param> /// <returns>返回搜索列表list</returns> public static void SearchLifeMList(ref List <Life> list, List <Life> HaveList, LifeMType Type, LifeMCamp Camp, Life Self, SearchTarageInfo SearchInfo) { if (list == null) { list = new List <Life> (); } else { list.Clear(); } //cm 中获取列表 if (HaveList == null || HaveList.Count == 0) { List <SceneSoldier> l = GetLifeMList(Type); if (l != null) { foreach (SceneSoldier s in l) { if (s == null) { continue; } LifeMCore Core = s.m_Core; Life life = s.m_Life; if (CheckCoreConditions(Core, Camp) == false) { continue; } if (CheckMapConditions(SearchInfo, Self, life) == false) { continue; } list.Add(life); } } } else //have list 中进行过滤 { foreach (Life life in HaveList) { if (life == null) { continue; } LifeMCore Core = life.m_Core; if (CheckCoreConditions(Core, Type, Camp) == false) { continue; } if (CheckMapConditions(SearchInfo, Self, life) == false) { continue; } list.Add(life); } } }