public Cutscene Load(string resourcePath) { var path = CutscenePathBase + "/" + resourcePath; var cutsceneAsset = Resources.Load(path) as TextAsset; if (cutsceneAsset != null) { return(DialogueUtils.ParseFromJson(cutsceneAsset.text)); } throw new ArgumentException("Cutscene not found at " + path); }
public override void Execute() { var path = Path.Combine("Dialogue", DialogueAssetPath); var text = Resources.Load(path) as TextAsset; if (text == null) { throw new ArgumentException("Could not find dialogue at " + path); } var model = DialogueUtils.ParseFromJson(text.text); NewCutsceneSignal.Dispatch(model); }
private void OnSceneChange(Scene oldScene, Scene newScene) { var playerMachine = Manager.Player.GetComponent <PlayerMachine>(); if (playerMachine) { modHUD.ToggleState(true, playerMachine); } else { if (modHUD) { modHUD.ToggleState(false, null); } } if (newScene.name == "void") { Basic_NPC spectralNpc = null; var npcs = Object.FindObjectsOfType <Basic_NPC>(); foreach (var npc in npcs) { var textAsset = npc.GetComponentInChildren <TalkVolume>().Dialogue; if (DialogueUtils.GetNPCName(textAsset.text) == "Oleia") { spectralNpc = npc; var collider = npc.GetComponentInChildren <Collider>(); if (collider) { npcDistance = collider.bounds.size.x; } break; } } if (spectralNpc != null) { LogDebug("Found Spectral!"); Object.Instantiate(spectralNpc, npcPos, Quaternion.identity); } } }
private void OnSceneChange(Scene oldScene, Scene newScene) { if (newScene.name == "void") { Basic_NPC legsNpc = null; var npcs = Object.FindObjectsOfType <Basic_NPC>(); foreach (var npc in npcs) { var textAsset = npc.GetComponentInChildren <TalkVolume>().Dialogue; if (DialogueUtils.GetNPCName(textAsset.text) == "Oleia") { legsNpc = npc; var collider = npc.GetComponentInChildren <Collider>(); if (collider) { npcDistance = collider.bounds.size.x; } break; } } if (legsNpc != null) { LogDebug("Found Oleia (Legs)!"); Object.Instantiate(legsNpc, npcPos, npcRot); } levelPos.Clear(); var boxes = GameObject.FindObjectsOfType <PizzaBox>(); foreach (var box in boxes) { string level = levelStr.GetValue(box) as string; if (level != null) { levelPos[level] = box.gameObject.transform.position; } } } }
private string Instance_OnParseScriptHook(string text) { string output = text; switch (DialogueUtils.GetNPCName(text)) { case "Oleia": var playerPos = Manager.Player.GetComponent <PlayerMachine>().transform.position; if (SceneManager.GetActiveScene().name == "void" && Vector3.Distance(npcPos, playerPos) <= npcDistance) { output = "%n10%v0%\r\nSpectral\r\n" + "%m1%Run%p11% %m0%%s.1%A%p8%l%p9%l %p10%%m1%N%p15%P%p16%Cs%p17%%sD%%p10%!\r\n\r\n%n\r\n"; } break; case "Denise": output = text.Replace(@"%v14", @"%v6"); break; } return(output); }
// Start void Start() { canNext = false; dialogueActive = false; lastChoiceID = 0; sceneName = SceneManager.GetActiveScene().name; if (sceneName.Contains("Day")) { inputFile = sceneName; } else { // Shops will use the JSON dialogue file belonging to the current Day scene inputFile = GameController.GetPreviousScene(); } switch (inputFile[3]) { case '1': startIndex = startIndexOne; endIndex = endIndexOne; break; case '2': startIndex = startIndexTwo; endIndex = endIndexTwo; break; } try { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovementController>(); } catch (NullReferenceException e) { } // Initialize all parent GameObjects for hiding and showing dialogue UI uiDialogue = GameObject.FindGameObjectWithTag("DialogueUI"); canDialogue = uiDialogue.transform.GetChild(1).gameObject; // Initialize dialogue text txtSpeaker = canDialogue.transform.GetChild(1).GetComponent <Text>(); txtDialogue = canDialogue.transform.GetChild(0).GetComponent <Text>(); choiceSelector = GetComponent <ChoiceSelector>(); lastNextTime = -999f; lastShowChoiceTime = -999f; dialogue = DialogueUtils.initDialogueForScene(inputFile); // Used only to translate dialogue from CSV into JSON //DialogueUtils.storeDialogueFromFile("Day2", "Day2"); // If there is initial dialogue to display and it hasn't been displayed before if (startIndex != 0 && !GameController.getLoadedScenes().Contains(sceneName) || !sceneName.Contains("Day")) { Show(startIndex); } GameController.addLoadedScene(sceneName); }