示例#1
0
 void Awake()
 {
     GameManager.Mode         = GameMode.Rehearsal;
     GameManager.TutorialMode = true;
     canvas              = GetComponentsInChildren <Canvas>(true);
     currentCanvasIndex  = 0;
     playerStartPosition = GameObject.FindGameObjectWithTag("Player").transform.localPosition;
     InteractablePathManager.SeedString = "A09206A09206000000000000000000000";
     InteractablePathManager.SetupInteractablePathIDs();
     InteractablePathManager.Initalize();
     menuBar = FindObjectOfType <MenuProgressTopBarUI>();
     menuBar.gameObject.GetComponent <Canvas>().sortingOrder = 1;
     sliderCanvas = FindObjectOfType <CameraSlider>().transform.parent.parent.gameObject.GetComponent <Canvas>();
     sliderCanvas.sortingOrder  = 1;
     minimapCanvas              = FindObjectOfType <MinimapUI>().gameObject.GetComponent <Canvas>();
     minimapCanvas.sortingOrder = 1;
 }
示例#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]);
    }