Пример #1
0
 void Awake()
 {
     if (planetPrefabs.Length == 0 || asteroidPrefabs.Length == 0 ||
         planetColors.Length == 0 || asteroidColors.Length == 0)
     {
         Debug.LogError("Must provide prefabs and colors for the universe generator");
     }
     instance = this;
     Random.InitState(System.Guid.NewGuid().GetHashCode());         // At one point this broke and the seed persisted after play mode had exited. Bug?
 }
Пример #2
0
 void Awake()
 {
     DontDestroyOnLoad(this);
     LoadModules();
     LoadEffects();
     LoadPlanets();
     LoadMapStars();
     LoadLocalStars();
     LoadFleetShips();
     LoadProjectiles();
     universeGenerator = new UniverseGenerator(1);
     universeManifest  = universeGenerator.universe;
 }
Пример #3
0
    void Start()
    {
        pc = new PlanetControllerImpl(fc, mapObject, game, baseFleet);
        if (!load)
        {
            UniverseGenerator gen = GetComponent <UniverseGenerator>();

            if (NewGameInit.instance != null)
            {
                game.getGame().setSize(NewGameInit.instance.size);
                game.getGame().setDensity(NewGameInit.instance.density);

                game.getGame().setName(NewGameInit.instance.gameName);

                game.getGame().getPlayers()[0].setRace(NewGameInit.instance.races[0]);
                game.getGame().getPlayers()[1].setRace(NewGameInit.instance.races[1]);
            }
            gen.setUniverseGenerator(game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());

            gen.generate();
        }
        else
        {
            LoadUniverseGenerator loadGen = GetComponent <LoadUniverseGenerator>();

            if (NewGameInit.instance != null)
            {
                game.getGame().setSize(NewGameInit.instance.size);
                game.getGame().setDensity(NewGameInit.instance.density);

                game.getGame().getPlayers()[0].setRace(NewGameInit.instance.races[0]);
                game.getGame().getPlayers()[1].setRace(NewGameInit.instance.races[1]);

                loadGen.setUniverseGenerator(Application.persistentDataPath + "/Game/" + NewGameInit.instance.gameName, game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());
            }
            else
            {
                loadGen.setUniverseGenerator(Application.persistentDataPath + "/Game/Game1/", game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());
            }

            loadGen.generate();
        }
        Settings.instance.playerID = game.getGame().getPlayers()[0].getID();

        layoutManager.LoadLayout();
    }
Пример #4
0
    void Start()
    {
        pc = new PlanetControllerImpl(fc, mapObject, game, baseFleet);
        if (!load)
        {
            UniverseGenerator gen = GetComponent <UniverseGenerator>();

            if (NewGameInit.instance != null)
            {
                game.getGame().setSize(NewGameInit.instance.size);
                game.getGame().setDensity(NewGameInit.instance.density);

                game.getGame().setName(NewGameInit.instance.gameName);

                game.getGame().getPlayers()[0].setName(NewGameInit.instance.playerNames[0]);
                game.getGame().getPlayers()[0].getUser().setName(NewGameInit.instance.playerNames[0]);
                game.getGame().getPlayers()[0].setRace(NewGameInit.instance.races[0]);
                game.getGame().getPlayers()[1].setRace(NewGameInit.instance.races[1]);
                game.getGame().getPlayers()[1].setName(NewGameInit.instance.playerNames[1]);
                game.getGame().getPlayers()[1].getUser().setName(NewGameInit.instance.playerNames[1]);

                game.getGame().getPlayers()[0].getUser().setAi(false);
                game.getGame().getPlayers()[1].getUser().setAi(false);
            }
            gen.setUniverseGenerator(game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());

            gen.generate();
        }
        else
        {
            LoadUniverseGenerator loadGen = GetComponent <LoadUniverseGenerator>();

            if (NewGameInit.instance != null)
            {
                game.getGame().setSize(NewGameInit.instance.size);
                game.getGame().setDensity(NewGameInit.instance.density);

                game.getGame().setName(NewGameInit.instance.gameName);

                game.getGame().getPlayers()[0].setName(NewGameInit.instance.playerNames[0]);
                game.getGame().getPlayers()[0].getUser().setName(NewGameInit.instance.playerNames[0]);
                game.getGame().getPlayers()[0].setRace(NewGameInit.instance.races[0]);
                game.getGame().getPlayers()[1].setRace(NewGameInit.instance.races[1]);
                game.getGame().getPlayers()[1].setName(NewGameInit.instance.playerNames[1]);
                game.getGame().getPlayers()[1].getUser().setName(NewGameInit.instance.playerNames[1]);

                game.getGame().getPlayers()[0].getUser().setAi(false);
                game.getGame().getPlayers()[1].getUser().setAi(false);

                loadGen.setUniverseGenerator(Application.persistentDataPath + "/Online/serverFile/", game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());
            }
            else
            {
                loadGen.setUniverseGenerator(Application.persistentDataPath + "/Online/serverFile/", game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());
            }

            loadGen.generate();

            new FileInfo(Application.persistentDataPath + "/Online/serverFile.zip").Delete();
            new DirectoryInfo(Application.persistentDataPath + "/Online/serverFile/").Delete(true);
        }

        messagePanel.playerIndex = researchPanel.playerIndex = planetReport.playerIndex = fleetReport.playerIndex = GameSparksManager.getInstance().getPlayerName() == game.getGame().getPlayers()[0].getName() ? 0 : 1;

        Settings.instance.playerID = GameSparksManager.getInstance().getPlayerName() == game.getGame().getPlayers()[0].getName() ? game.getGame().getPlayers()[0].getID() : game.getGame().getPlayers()[1].getID();

        layoutManager.LoadLayout();
    }
Пример #5
0
 public void SetParent(GameObject go)
 {
     Universe = go.GetComponent <UniverseGenerator>();
 }
Пример #6
0
 void Awake()
 {
     DontDestroyOnLoad(this);
     LoadModules();
     LoadEffects();
     LoadPlanets();
     LoadMapStars();
     LoadLocalStars();
     LoadFleetShips();
     LoadProjectiles();
     universeGenerator = new UniverseGenerator(1);
     universeManifest = universeGenerator.universe;
 }