private IEnumerator ActiveObject(float time, string other) { yield return(new WaitForSeconds(time)); if (gObj != null) { gObj.SetActive(true); ThrowDialog dialog = gObj.GetComponent <ThrowDialog>(); if (dialog != null) { dialog.ThrowDialogNow(); } } foreach (GameObject g in secundaryObjects) { g.SetActive(true); } Image img = gObj.GetComponent <Image>(); if (img != null) { img.sprite = Resources.Load <Sprite>(other); } }
/// <summary> /// Fade out /// </summary> private void FadeOutObject() { ThrowDialog t = this.gameObject.GetComponent <ThrowDialog>(); if (t) { t.enabled = false; } Invoke("OffCollider", duration); fade = true; }
/// <summary> /// move the camera /// </summary> private void moveCamera() { CameraScroll cam = sceneCamera.GetComponent <CameraScroll>(); cam.scroll_min = minScroll; cam.scroll_max = maxScroll; sceneCamera.transform.localPosition = new Vector3(x, y, sceneCamera.transform.localPosition.z); if (throwMyDialog) { ThrowDialog t = this.gameObject.GetComponent <ThrowDialog>(); if (t) { t.ThrowDialogNow(); } } }
private IEnumerator DeactiveObject(float time) { yield return(new WaitForSeconds(time)); if (gObj != null) { gObj.SetActive(false); ThrowDialog dialog = gObj.GetComponent <ThrowDialog>(); if (dialog != null) { dialog.ThrowDialogNow(); } } foreach (GameObject g in secundaryObjects) { g.SetActive(false); } }
private void Awake() { sequenceDict = new Dictionary <string, Sequence>(); gameEvent = new GameEvent(); this.gameEvent.Name = "start sequence"; //char[] MyChar = { '.', 'j', 's', 'o', 'n' }; //string newName = fileName.TrimEnd(MyChar); string newName = fileName.Replace(".json", ""); fileName = newName; if (LanguageSelector.instance.GetCurrentLanguage() == null) { Debug.LogError("ERROR: Global Language not set up propertly. Switching to en_UK."); LanguageSelector.instance.SetLanguage("en_UK"); jsonFile = Resources.Load <TextAsset>("Localization/" + "en_UK" + "/Dictionaries" + fileName); } else { jsonFile = Resources.Load <TextAsset>("Localization/" + LanguageSelector.instance.GetCurrentLanguage() + "/" + fileName); } string fileContents = jsonFile.text; JSONObject json = JSONObject.Create(fileContents); foreach (Transform child in transform) { if (!child.GetComponent <ThrowDialog>()) { Debug.LogWarning("The object with the name " + child.gameObject.name + " doesn't have ThrowDialog component"); } else { ThrowDialog dialog = child.GetComponent <ThrowDialog>(); String saveName = dialog.fieldName; String name = saveName.First().ToString().ToLower() + saveName.Substring(1); if (!sequenceDict.ContainsKey(saveName)) { try { if (json.HasField(name)) { sequenceDict.Add(saveName, SequenceGenerator.createSimplyDialog(name, json, variablesObject)); } else if (json.HasField(name.ToLower())) { sequenceDict.Add(saveName, SequenceGenerator.createSimplyDialog(name.ToLower(), json, variablesObject)); } else { Debug.LogWarning("Dialog with key " + name + " doesn't exist in file " + fileName); } } catch (Exception e) { Debug.LogError("Error in " + jsonFile.name + " file. The error is: " + e.Message); } } } } }