Example #1
0
    /// <summary>
    /// The main generation function for the whole game
    /// Creates a <see cref="GameGenerator"/> and then creates a world using <see cref="GameGenerator.GenerateWorld"/>
    /// Then generates all quests using <see cref="GameGenerator.GenerateQuests(World)"/>
    /// </summary>
    /// <param name="seed">Seed fed to the <see cref="GameGenerator"/> that defines the generation</param>
    private void GenerateGame(int seed)
    {
        //Initiate GameGenerator, then generate and set world
        //Debug.BeginDeepProfile("generate_world");

        GameGenerator = new GameGenerator(seed);
        GameGenerator.GenerateWorld(WorldManager);
        GameGenerator.GenerateEntities(WorldManager.World);
        GameGenerator.GenerateDungeons();
        GameGenerator.GenerateWorldMap();
        QuestManager.SetQuests(GameGenerator.GenerateQuests(WorldManager.World));


        Vec2i wpos = Vec2i.FromVector2(QuestManager.Unstarted[0].Initiator.GetNPC().Position2);
        //Vec2i wpos = WorldManager.World.GetChunkStructure(0).Position * World.ChunkSize + new Vec2i(2, 2);
        Vec2i wEntr = WorldManager.World.GetSubworld(1).WorldEntrance;

        TestSettle = QuestManager.Unstarted[0].Initiator.GetNPC().NPCKingdomData.GetSettlement();
        Debug.Log(TestSettle);


        Vec2i playerStartreg = World.GetRegionCoordFromChunkCoord(World.GetChunkPosition(wpos));


        ChunkRegionGenerator = GameGenerator.GenerateChunks(playerStartreg);
        GeneratePlayer(wpos);
    }