Exemplo n.º 1
0
    private void CreateMap()
    {
        MapPreset _CurrentPreset;

        if (mapDropdown.value == 0)
        {
            _CurrentPreset = MapPresets[UnityEngine.Random.Range(0, MapPresets.Count - 1)];
        }
        else
        {
            _CurrentPreset = MapPresets[mapDropdown.value - 1];
        }

        MeshGenerator _MeshGenerator = FindObjectOfType <MeshGenerator>();

        _MeshGenerator.Preset    = _CurrentPreset;
        _MeshGenerator.UsePreset = true;
        _MeshGenerator.Seed      = int.Parse(seedInput.text);
        _MeshGenerator.GenerateMesh();

        CreateResources(_MeshGenerator);
        CreatePlayer(_MeshGenerator);
        CreateMissions(_MeshGenerator);
        _MeshGenerator.BuildNavigationMesh();
    }