/// <summary> /// Creates group (without calling Select) from given list with IStaticGameObjects. /// Objects from the player team has greater priority then others, so if list contains /// any so the others will not be selected. /// </summary> /// <param Name="isgoList">The List with IStaticGameObjects</param> public void CreateInfoGroup(List <IStaticGameObject> isgoList) { if (isgoList.Count > 0) { var group = new GroupStatics(isgoList[0].Team); group.InsertMemeber(isgoList[0]); // Insert first var inGroup = isgoList[0]; if (isgoList.Count > 1) // Check if there is more object { for (int i = 1; i < isgoList.Count; i++) { if (inGroup.Team == isgoList[i].Team) { group.InsertMemeber(isgoList[i]); // Insert player isgo } else { if (isgoList[i].Team.Name == Game.PlayerName) // In some of elements in isgoList is players -> has greater priority { group = new GroupStatics(isgoList[i].Team); group.InsertMemeber(isgoList[i]); // Insert firt inGroup = isgoList[i]; } } } } targetedMgr.TargetGroup(group); } else { targetedMgr.TargetGroup(new GroupStatics()); } targetedMgr.ShowTargetedGroup(); }
/// <summary> /// Removes objects from their group and creates new one. /// The list can contains some IMovableGameObjects so they must be removed. /// </summary> /// <param name="igoList">The list with IStaticGameObjects and IMovableGameObjects</param> /// <returns>Returns created group with IStaticGameObjects from the igoList</returns> public GroupStatics CreateSelectedGroupStatic(List <IGameObject> igoList) { var group = new GroupStatics(igoList[0].Team); foreach (var igo in igoList) { var imgo = igo as IStaticGameObject; if (imgo != null) { group.InsertMemeber(imgo); } } return(group); }