Esempio n. 1
0
    IEnumerator do_generate(NodeLayout layout) // pipeline for initial generation of all nodes and stuff
    {
        foreach (GameObject obj in HideableButtons)
        {
            obj.SetActive(false);
        }

        if (layout == null)
        {
            layout = m_layouts.Layouts.FirstOrDefault(x => x.NumPlayers == m_player_count);
        }

        m_season = Season.SUMMER;

        // create the conceptual nodes and connections first
        WorldGenerator.GenerateWorld(m_teamplay, m_cluster_water, NatStarts.isOn, m_nations, layout);
        List <Connection> conns = WorldGenerator.GetConnections();
        List <Node>       nodes = WorldGenerator.GetNodes();

        // generate the unity objects using the conceptual nodes
        ElementManager mgr = GetComponent <ElementManager>();

        // position and resize the cameras
        Vector3 campos = new Vector3(layout.X * 0.5f * mgr.X - mgr.X, layout.Y * 0.5f * mgr.Y - mgr.Y, -10);

        CaptureCamera.transform.position = campos;

        float ortho = (mgr.Y * layout.Y * 100) / 100f / 2f;

        CaptureCamera.orthographicSize = ortho;

        yield return(StartCoroutine(mgr.GenerateElements(nodes, conns, layout)));

        ProvinceManager.s_province_manager.SetLayout(layout);
        ConnectionManager.s_connection_manager.SetLayout(layout);
        Camera.main.transform.position = campos + new Vector3(500f, 0f, 0f);

        foreach (GameObject obj in HideableButtons)
        {
            obj.SetActive(true);
        }
    }