Пример #1
0
 public Dictionary<Empire, List<StarSystem>> CheckExploredSystems(Galaxy galaxy)
 {
     Dictionary<Empire, List<StarSystem>> exploredSystems = new Dictionary<Empire, List<StarSystem>>();
     foreach (Empire empire in _empires)
     {
         List<StarSystem> temp = empire.CheckExploredSystems(galaxy);
         if (empire.Type == PlayerType.HUMAN && temp.Count > 0)
         {
             exploredSystems.Add(empire, temp);
         }
     }
     return exploredSystems;
 }
Пример #2
0
 public Dictionary<Empire, List<Fleet>> CheckColonizableSystems(Galaxy galaxy)
 {
     Dictionary<Empire, List<Fleet>> colonizableSystems = new Dictionary<Empire, List<Fleet>>();
     foreach (Empire empire in _empires)
     {
         List<Fleet> temp = empire.CheckColonizableSystems(galaxy);
         if (empire.Type == PlayerType.HUMAN && temp.Count > 0)
         {
             colonizableSystems.Add(empire, temp);
         }
     }
     return colonizableSystems;
 }
Пример #3
0
 public List<StarSystem> CheckExploredSystems(Galaxy galaxy)
 {
     List<StarSystem> exploredSystems = new List<StarSystem>();
     foreach (Fleet fleet in FleetManager.GetFleets())
     {
         if (fleet.TravelNodes == null || fleet.TravelNodes.Count == 0)
         {
             StarSystem systemExplored = fleet.AdjacentSystem;
             if (systemExplored != null && !systemExplored.IsThisSystemExploredByEmpire(this))
             {
                 SitRepManager.AddItem(new SitRepItem(Screen.Galaxy, systemExplored, null, new Point(systemExplored.X, systemExplored.Y), systemExplored.Name + " has been explored."));
                 systemExplored.AddEmpireExplored(this);
                 exploredSystems.Add(systemExplored);
             }
         }
     }
     return exploredSystems;
 }
Пример #4
0
 public List<Fleet> CheckColonizableSystems(Galaxy galaxy)
 {
     List<Fleet> colonizingFleets = new List<Fleet>();
     foreach (Fleet fleet in FleetManager.GetFleets())
     {
         if (fleet.TravelNodes == null || fleet.TravelNodes.Count == 0)
         {
             if (fleet.AdjacentSystem.Planets[0].Owner != null)
             {
                 continue;
             }
             int colonyReq = fleet.AdjacentSystem.Planets[0].ColonyRequirement;
             foreach (Ship ship in fleet.OrderedShips)
             {
                 foreach (var special in ship.Specials)
                 {
                     if (special != null && special.Technology.Colony >= colonyReq)
                     {
                         colonizingFleets.Add(fleet);
                         break;
                     }
                 }
             }
         }
     }
     return colonizingFleets;
 }
Пример #5
0
        public bool Initalize(int screenWidth, int screenHeight, DirectoryInfo dataSet, bool showTutorial, Form parentForm, out string reason)
        {
            _parentForm = parentForm;

            Random = new Random();

            MousePos = new Point();

            ScreenWidth = screenWidth;
            ScreenHeight = screenHeight;
            GameDataSet = dataSet;

            Galaxy = new Galaxy();
            EmpireManager = new EmpireManager(this);

            ShipShader = GorgonLibrary.Graphics.FXShader.FromFile("ColorShader.fx", GorgonLibrary.Graphics.ShaderCompileOptions.OptimizationLevel3);
            StarShader = GorgonLibrary.Graphics.FXShader.FromFile("StarShader.fx", GorgonLibrary.Graphics.ShaderCompileOptions.OptimizationLevel3);

            if (!SpriteManager.Initialize(GameDataSet, out reason))
            {
                return false;
            }
            if (!FontManager.Initialize(GameDataSet, out reason))
            {
                return false;
            }
            RaceManager = new RaceManager();
            if (!RaceManager.Initialize(GameDataSet, Random, out reason))
            {
                return false;
            }
            AIManager = new AIManager();
            if (!AIManager.Initialize(GameDataSet, out reason))
            {
                return false;
            }
            MasterTechnologyManager = new MasterTechnologyManager();
            if (!MasterTechnologyManager.Initialize(this, out reason))
            {
                return false;
            }
            _mainGameMenu = new MainGameMenu();
            if (!_mainGameMenu.Initialize(this, out reason))
            {
                return false;
            }

            _screenInterface = _mainGameMenu;
            _currentScreen = Screen.MainMenu;

            _situationReport = new SituationReport(this);

            Cursor = SpriteManager.GetSprite("Cursor", Random);
            if (Cursor == null)
            {
                reason = "Cursor is not defined in sprites.xml";
                return false;
            }

            reason = string.Empty;
            return true;
        }
Пример #6
0
        public void SetTentativePath(StarSystem destination, bool hasExtendedFuelTanks, Galaxy galaxy)
        {
            if (destination == null || destination == _adjacentSystem)
            {
                //if destination is same as origin, or nowhere, clear the tentative path
                TentativeNodes = null;
                return;
            }
            if (_travelNodes != null && _travelNodes[_travelNodes.Count - 1].StarSystem == destination)
            {
                //Same path as current path
                TentativeNodes = null;
                return;
            }
            if (TentativeNodes != null && TentativeNodes[_tentativeNodes.Count - 1].StarSystem == destination)
            {
                // Existing tentative path
                return;
            }

            StarSystem currentDestination = null;
            if (_adjacentSystem == null) //Has left a system
            {
                currentDestination = _travelNodes[0].StarSystem;
            }
            List<TravelNode> path = galaxy.GetPath(_galaxyX, _galaxyY, currentDestination, destination, hasExtendedFuelTanks, _empire);
            if (path == null)
            {
                TentativeNodes = null;
                return;
            }

            TentativeNodes = path;
            if (TentativeNodes.Count == 0)
            {
                TentativeNodes = null;
            }
        }