Пример #1
0
        private IEnumerator buildFromProtoStars(Dictionary <int, List <ProtoStar> > protoNodes)
        {
            yield return(null);

            objectTable = new ObjectTable();
            idMaker     = new UniqueIdMaker(0, objectTable);
            var collection  = new Dictionary <int, List <StarNode> >();
            var userFaction = factions.setUserFaction("my faction");

            user = new User(userFaction);
            var AIFaction  = factions.createAIFaction("Ai1");
            var AI2Faction = factions.createAIFaction("Ai2");

            factories.fleetFactory = new Dictionary <Faction, FleetFactory>()
            {
                { userFaction, userFaction.fleetFactory },
                { AIFaction, AIFaction.fleetFactory },
                { AI2Faction, AI2Faction.fleetFactory },
            };
            AI2Faction.startAI();
            AIFaction.startAI();
            yield return(instance.galaxyCreator.hydrate(protoNodes, collection));

            instance._starNodes = new StarNodeCollection(collection);
        }
Пример #2
0
        private IEnumerator buildGameFromSave(SavedGame savedGame)
        {
            yield return(null);

            objectTable = new ObjectTable();
            idMaker     = new UniqueIdMaker(savedGame.loadedModel.idMaker, objectTable);
            foreach (var factionRef in savedGame.loadedModel.factions)
            {
                factions.createFaction((FactionState)savedGame.loadedModel.objectTable[factionRef.id]);
            }
            instance.user = new User(factions.userFaction);
            var collection = new Dictionary <int, List <StarNode> >();

            yield return(galaxyCreator.hydrate(savedGame, collection));

            instance._starNodes = new StarNodeCollection(collection);
        }