public void selectCharacter() { if (!speechCanvas.gameObject.activeInHierarchy && !lupa.pressed) { //Setar os valores do canvas SpeechManager sm = speechCanvas.GetComponent <SpeechManager>(); sm.OpenText(texts); } }
// Update is called once per frame void OnMouseDown() { if (lupa.pressed) { //Adicionar ao inventário //Abrir um texto GlobalProfile.getInstance().addItem(new InventoryItem(itemId, displayName, spriteRenderer.sprite)); //Destruir item speech.OpenText(texts); Destroy(gameObject); } }
// Update is called once per frame void OnMouseDown() { if (!PauseUI.Paused) { if (!speech.isActiveAndEnabled) { //Adicionar ao inventário //Abrir um texto GlobalProfile.getInstance().addItem(new InventoryItem(data.itemId, data.displayName, spriteRenderer.sprite, data.itemDescription)); //Destruir item Debug.Log("Adding item with sprite: " + spriteRenderer.sprite.texture.name); GlobalProfile.getInstance().SendMessage(data.itemId); GlobalProfile.getInstance().SaveInventory(); manager.RefreshAllCharacterDialogData(); speech.OpenText(data.dialogo.texts); Destroy(gameObject); } } }
// Start is called before the first frame update void Start() { speech.OpenText(initialTexts); }
// Start is called before the first frame update void Start() { string scenarioName = GlobalProfile.GetCurrentSceneName(); GlobalProfile.getInstance().LoadGame(textureManager); GlobalProfile.getInstance().addItem(new InventoryItem(cenario_pista, scenarioName, textureManager.GetSpritePista(cenario_pista), cenario_desc)); GlobalProfile.getInstance().SaveGame(); //Carrega dados do cenário if (SaveGameSystem.DoesSaveGameExist("slot" + GlobalProfile.Slot + "_" + scenarioName)) { scenarioData = (ScenarioData)SaveGameSystem.LoadGame("slot" + GlobalProfile.Slot + "_" + scenarioName); if (scenarioData != null) { //Limpando os personagens e instanciando de novo foreach (Transform child in personagens_folder.transform) { GameObject.Destroy(child.gameObject); } for (int i = 0; i < scenarioData.characters.Count; i++) { GameObject character = Instantiate(personagemPrefab); character.transform.SetParent(personagens_folder.transform, false); character.GetComponent <SpeechableCharacter>().LoadData(scenarioData.characters[i], speechManager, this); } //Limpando pistas e instanciando de novo foreach (Transform child in pistas_folder.transform) { GameObject.Destroy(child.gameObject); } for (int i = 0; i < scenarioData.pistas.Count; i++) { GameObject pista = Instantiate(pistaPrefab); pista.transform.SetParent(pistas_folder.transform, false); pista.GetComponent <PistaItem>().LoadData(scenarioData.pistas[i], speechManager, this); } //Limpando exits e instanciando de novo foreach (Transform child in exits_folder.transform) { GameObject.Destroy(child.gameObject); } for (int i = 0; i < scenarioData.exits.Count; i++) { GameObject exit = Instantiate(exitPrefab); exit.transform.SetParent(exits_folder.transform, false); exit.GetComponent <ExitPoint>().LoadData(scenarioData.exits[i], this, speechManager); } } } if (GlobalProfile.getInstance().dialogIgnition != null) { speechManager.OpenText(GlobalProfile.getInstance().dialogIgnition); } //string output = JsonUtility.ToJson(CreateScenarioData(),true); //Debug.Log(output); }