Beyond_Beyaan.EmpireManager.GetEmpire C# (CSharp) Метод

GetEmpire() публичный Метод

public GetEmpire ( int empireId ) : Empire
empireId int
Результат Empire
        public Empire GetEmpire(int empireId)
        {
            foreach (Empire empire in _empires)
            {
                if (empire.EmpireID == empireId)
                {
                    return empire;
                }
            }
            return null;
        }

Usage Example

Пример #1
0
 public void Reconcilate(EmpireManager empireManager)
 {
     foreach (var star in starSystems)
     {
         //Set the empire
         foreach (var planet in star.Planets)
         {
             if (planet.OwnerID != -1)
             {
                 planet.Owner   = empireManager.GetEmpire(planet.OwnerID);
                 planet.OwnerID = -1;                         //Clear out the ID
                 planet.Owner.PlanetManager.AddOwnedPlanet(planet);
                 planet.ShipBeingBuilt = planet.Owner.FleetManager.GetShipWithDesignID(planet.ShipBeingBuiltID);
             }
         }
         star.UpdateOwners();
         if (string.IsNullOrEmpty(star.ExploredByIDs))
         {
             //No empires explored this star yet.
             continue;
         }
         string[] exploredBy = star.ExploredByIDs.Split(new[] { ',' });
         foreach (var explored in exploredBy)
         {
             star.AddEmpireExplored(empireManager.GetEmpire(int.Parse(explored)));
         }
     }
 }
All Usage Examples Of Beyond_Beyaan.EmpireManager::GetEmpire