Пример #1
0
 public void SetWorldScenes()
 {
     WorldManager.Reset();
     foreach (int sceneIndex in currentList)
     {
         WorldManager.Add(sceneIndex);
     }
 }
Пример #2
0
    // Creates a custom learn mode - does the heavy lifting for the above two functions
    public static string learnTest(string input, bool random, bool iterative, bool tryToBreak)
    {
        string[] stringInputs = input.Split(null);
        int[]    scenes       = new int[InteractableConfig.SitesPerGame];
        int[]    actions      = new int[InteractableConfig.SitesPerGame + (InteractableConfig.SitesPerGame * InteractableConfig.ActionsPerSite * 2)];
        if (stringInputs.Length <= 0 || input == null || input == "")
        {
            return("Please enter at least one scene name for the custom learn path.");
        }
        Debug.Log("Input: " + input);
        Debug.Log("String input length: " + stringInputs.Length);

        for (int i = 0; i < InteractableConfig.SitesPerGame; i++)
        {
            // queue up the scenes entered by user into a seed
            if (i < stringInputs.Length)
            {
                if (sceneIndeces.ContainsKey(stringInputs[i]))
                {
                    scenes[i] = sceneIndeces[stringInputs[i]];
                }
                else if (fuzzySceneNames.ContainsKey(stringInputs[i]))
                {
                    scenes[i] = sceneIndeces[fuzzySceneNames[stringInputs[i]]];
                }
                else
                {
                    Debug.Log("Do not recognize scene name: " + stringInputs[i]);
                    return("Do not recognize scene name: " + stringInputs[i]);
                }
            }
            else
            {
                scenes[i] = 2;
            }
        }

        int counter = 0;

        // Create custom seed using the chosen scenes
        for (int i = 0; i < InteractableConfig.SitesPerGame; i++)
        {
            actions[i + i * InteractableConfig.ActionsPerSite * 2] = scenes[i];

            for (int j = 0; j < InteractableConfig.ActionsPerSite; j++)
            {
                if (iterative)
                {
                    actions[j * 2 + 1 + i + i * InteractableConfig.ActionsPerSite * 2] = counter % 16;
                }
                else if (random)
                {
                    actions[j * 2 + 1 + i + i * InteractableConfig.ActionsPerSite * 2] = UnityEngine.Random.Range(0, 100) % 16;
                }
                else if (tryToBreak)
                {
                    actions[j * 2 + 1 + i + i * InteractableConfig.ActionsPerSite * 2] = j + 13;
                }
                else
                {
                    actions[j * 2 + 1 + i + i * InteractableConfig.ActionsPerSite * 2] = j % 16;
                }

                actions[j * 2 + 2 + i + i * InteractableConfig.ActionsPerSite * 2] = j % 4;

                //if (iterative)
                //    Debug.Log("Counter " + counter % 16);
                counter++;
            }
        }

        SeedToByte seeds = new SeedToByte();
        string     seed  = seeds.getSeed(actions);

        Debug.Log("Artificial seed: " + seed);

        InteractablePathManager.SeedString = seed;
        InteractablePath.ResetPath();
        InteractablePathManager.Reset();
        if (GameManager.V2Menus)
        {
            WorldManager.Reset();
        }
        else
        {
            LevelSetManager.ResetCurrentLevels();
        }


        for (int i = 0; i < scenes.Length; i++)
        {
            if (GameManager.V2Menus)
            {
                WorldManager.Add(scenes[i]);
            }
            else
            {
                LevelSetManager.AddLevel(scenes[i]);
            }
        }

        GameManager.Mode  = GameMode.Rehearsal;
        GameManager.State = GameState.Play;
        InteractablePathManager.Initalize();

        if (fuzzySceneNames.ContainsKey(stringInputs[0]))
        {
            SceneManager.LoadScene(fuzzySceneNames[stringInputs[0]]);
            return("Loading custom seed. Scene: " + fuzzySceneNames[stringInputs[0]]);
        }
        else
        {
            Debug.Log("Could not find scene named " + stringInputs[0]);
        }

        SceneManager.LoadScene(stringInputs[0]);

        return("Loading custom seed. Scene: " + stringInputs[0]);
    }