// Skip the current scene. Only works in Learn/reheasal mode. public static string skipScene(string input) { if (GameManager.Mode == GameMode.Rehearsal) { int actionsThisScene = InteractableLog.Count % InteractableConfig.ActionsPerSite; for (int i = 0 + actionsThisScene; i < InteractableConfig.ActionsPerSite; i++) { Debug.Log("Auto-performing action " + (i + 1)); InteractableManager.SetActiveInteractable(InteractablePath.NextInteractable, InteractablePath.NextAction); InteractableLog.Add(InteractablePath.NextInteractable, InteractablePath.NextAction); InteractablePath.GoToNextInteractable(); } return("Skiping scene"); } else if (GameManager.Mode == GameMode.Recall) { int actionsThisScene = InteractableLog.Count % InteractableConfig.ActionsPerSite; for (int i = 0 + actionsThisScene; i < InteractableConfig.ActionsPerSite; i++) { Debug.Log("Auto-performing action " + (i + 1)); InteractableLog.Add(InteractableManager.InteractableList[0], 0); } return("Skiping scene"); } return("Skip scene only supports Learn and Recal modes."); }
// In learn mode, perform the next queued action public static string doNextAction(string input) { if (InteractablePath.NextInteractable != null && GameManager.Mode == GameMode.Rehearsal) { InteractablePath.GoToNextInteractable(); } return("Performing next queued action"); }
//Formats the path data into a more readable format public static string formatPathData(InteractablePath pathObject) { if (pathObject == null) { return("Could not find instance of InteractablePath object"); } string data = "Interactable path data:"; foreach (Interactable item in pathObject.path) { data += "\n" + stringifyInteractable(item); } return(data); }
void clickActionButton(int actionIndex) { if (GameManager.Mode == GameMode.Rehearsal) { if (actionIndex == InteractablePath.NextInteractable.ActionIndex && interactable.ID == InteractablePath.NextInteractable.ID) { InteractableLog.Add(interactable, actionIndex); InteractablePath.GoToNextInteractable(); } } else if (GameManager.Mode == GameMode.Recall || GameManager.Mode == GameMode.Sandbox) { InteractableLog.Add(interactable, actionIndex); } InteractableActionsUI.Toggle(false); }
public void CheckForButtonDown() { if (buttonPressed && !progressCompleted) { time += Time.deltaTime; if (time >= 0.2f) { float progressPosition = 360 * (-1 + (time - 0.2f / 1.0f)); RectTransform progressTransform = progress.GetComponent <RectTransform>(); progressTransform.offsetMax = new Vector2(progressPosition, progressTransform.offsetMax.y); if (time >= 1.2f) { if (GameManager.Mode == GameMode.Rehearsal) { if (interactable.ID == InteractablePath.NextInteractable.ID && actionIndex == InteractablePath.NextAction) { InteractableManager.SetActiveInteractable(interactable, actionIndex); interactable.SelectAction(actionIndex); InteractablePath.GoToNextInteractable(); } } else { interactable.SelectAction(actionIndex); } progressCompleted = true; progressTransform.offsetMax = new Vector2(-360, progressTransform.offsetMax.y); time = 0.0f; } } } else { RectTransform progressTransform = progress.GetComponent <RectTransform>(); progressTransform.offsetMax = new Vector2(-360, progressTransform.offsetMax.y); time = 0.0f; EventSystem.current.SetSelectedGameObject(null); } }
private void Update() { if (currentCanvasIndex == 2) { menuBar.gameObject.GetComponent <Canvas>().sortingOrder = 3; } if (currentCanvasIndex == 5) { menuBar.gameObject.GetComponent <Canvas>().sortingOrder = 1; GameObject player = GameObject.FindGameObjectWithTag("Player"); if (Vector3.Distance(playerStartPosition, player.transform.localPosition) > 0.037) { if (!coroutineStarted) { coroutineStarted = true; StartCoroutine(WaitNextCanvas(1.5f)); } } } if (currentCanvasIndex == 6) { minimapCanvas.sortingOrder = 3; sliderCanvas.sortingOrder = 3; } if (currentCanvasIndex == 7) { minimapCanvas.sortingOrder = 1; sliderCanvas.sortingOrder = 1; } if (currentCanvasIndex < 10) { if (InteractableLog.Count > 0) { InteractablePathManager.Reset(); InteractablePath.InitializeNextInteractable(); } } else if (currentCanvasIndex == 10) { if (InteractableLog.Count > 0) { NextCanvas(); } } else if (currentCanvasIndex == 11) { if (InteractableLog.Count == 2) { GoToCanvas(13); } } else if (currentCanvasIndex == 12) { if (InteractableLog.Count == 0) { GoToCanvas(11); } } else if (currentCanvasIndex == 13) { if (InteractableLog.Count == 3) { InteractablePathManager.Reset(); InteractablePreviewUI.ToggleShow(); InteractableManager.UnHighlightAllInteractables(); InteractableManager.UnTrackAllInteractables(); ParticleSystem[] particles = FindObjectsOfType <ParticleSystem>(); foreach (ParticleSystem particle in particles) { particle.Stop(); } GoToCanvas(14); } } else if (currentCanvasIndex == 14) { if (recall) { //Debug.Log(InteractableLog.Count); if (InteractableLog.Count == 3) { GoToCanvas(15); } } } }
// 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]); }