Пример #1
0
 public IEnumerator WaitForMapGeneration(MapGenerator.GenerateMap thread)
 {
     MapGenScreen.SetActive(true);
     while (!thread.IsDone)
     {
         GenesisText.GetComponent <Text>().text = "Genesis took " + Mathf.FloorToInt(Time.realtimeSinceStartup - TimeStamp) + " seconds";
         thread.Update();
         yield return(null);
     }
     thread.Update();
     MapGenScreen.SetActive(false);
 }
Пример #2
0
    private void InitializeGame()
    {
        System.Random rng = new System.Random();
        // int seed = 1216466133;
        int seed = rng.Next();

        SeedText.GetComponent <Text>().text = "Seed = " + seed.ToString();
        rng = new System.Random(seed);
        Debug.Log("Seed = " + seed);

        TimeStamp = Time.realtimeSinceStartup;
        MapGenerator.GenerateMap thread = new MapGenerator.GenerateMap(MapSize, rng.Next(), System.Environment.ProcessorCount - 1, OnWorldGenerated);
        thread.Start();
        StartCoroutine(WaitForMapGeneration(thread));
    }