private void NextLine() { if (onDialouge) { currentDialouge.NextLine(); } else { if (currentDialougeInt < dialouges.Length) { TurnOffDialouges(); dialouges[currentDialougeInt].SetActive(true); currentDialouge = dialouges[currentDialougeInt].gameObject.GetComponent <Dialouge>(); currentDialougeInt += 1; onDialouge = true; } else { if (!loadingNextScene) { loadingNextScene = true; LoadNextScene(); } } } }
/* DIALOUGE MANAGEMENT */ public void StartDialouge(Dialouge dialouge) { inDialouge = true; canvas.enabled = true; ClearAndAddNewSentences(dialouge); DisplayNextSentence(); }
public void StartDialouge(Dialouge dialouge) { nameText.text = dialouge.name; sentences.Clear(); faceHere.sprite = dialouge.face.sprite; foreach (string sentence in dialouge.sentences) { sentences.Enqueue(sentence); } opt1Text.text = dialouge.choices[0]; opt2Text.text = dialouge.choices[1]; opt3Text.text = dialouge.choices[2]; opt4Text.text = dialouge.choices[3]; reactionText.text = dialouge.reaction; convNameHere = dialouge.convName; FindObjectOfType <TextLog>().whatConv(convNameHere); DisplayNextSentence(); }
public void StartDialouge(Dialouge dialouge) { Debug.Log("Starting Dialouge"); sentences.Clear(); names.Clear(); inConversation = true; animator.SetBool("inDialouge", true); foreach (string sentence in dialouge.sentences) { sentences.Enqueue(sentence); sentenceCount++; } foreach (string name in dialouge.name) { names.Enqueue(name); nameCount++; } if (nameCount != sentenceCount) { Debug.Log("OH DANG! There are " + nameCount + "names and " + sentenceCount + "sentences! If those numbers ain't adding up, FIX IT!"); } DisplayNextSentence(); }
private Dialouge getDia(Event.Talk curTalk) { if (curDia == null) { curDia = new Dialouge(curTalk.dialouge, curTalk.image, curTalk.pitch); } return(curDia); }
void move() { rb.velocity = Vector2.zero; // rb.angularVelocity = 0; Vector2 moveDirection = Vector2.zero; float x = Input.GetAxis("Horizontal"); float y = Input.GetAxis("Vertical"); if (x != 0 && y != 0) { return; /*no diagonal movement */ } if (x != 0) { if (x > 0) { face = Vector2.right; animator.SetInteger("MoveDirection", 2); } else { face = Vector2.left; animator.SetInteger("MoveDirection", 1); } } if (y != 0) { if (y > 0) { face = Vector2.up; animator.SetInteger("MoveDirection", 3); } else { face = Vector2.down; animator.SetInteger("MoveDirection", 4); } } moveDirection = new Vector2(x, y); moveDirection *= speed; rb.velocity = moveDirection; if (Input.GetButtonDown("Fire1")) { int mask = LayerMask.GetMask("interakcja"); RaycastHit2D hit = Physics2D.Raycast(transform.position, face, 10, mask); if (hit) { GameObject obj = hit.collider.gameObject; Dialouge d = obj.GetComponent <Dialouge>(); if (d != null) { startDialouge(d); } } } }
private void ClearAndAddNewSentences(Dialouge dialouge) { sentences.Clear(); foreach (Sentence sentence in dialouge.sentences) { sentences.Enqueue(sentence); } sentencesLeft = sentences.Count; }
void Start() { interestingDialouge = new Dialouge(); interestingDialouge.name = "You"; farDialouge = new Dialouge(); farDialouge.name = "You"; investigatingDialouge = new Dialouge(); investigatingDialouge.name = "You"; }
public void StartConversation(Dialouge dialouge) { Sentences.Clear(); animator.SetBool("IsOpen", true); foreach (string sentence in dialouge.sentences) { Sentences.Enqueue(sentence); } DisplayNextDialouge(); }
// This function starts the dialouge public void StartDialouge(Dialouge dialouge) { /* Assigning a tracker that keeps tracking * the navigation between nodes */ DialougeTracker = dialouge; //Showing the name of the NPC, and the first dialouge node NameText.text = dialouge.name; ShowNode(DialougeTracker.DialougeTreeNodes[0], 0); }
public void StartDialouge(Dialouge dialouge) { //Debug.Log("starting dialouge with " + dialouge.sentences[0].nameOfCharacter); sentences.Clear(); foreach (Sentence sentence in dialouge.sentences) { sentences.Enqueue(sentence); } DisplayNextSentence(); }
//for investigating; look at comments higher up public void StartInvDialouge(Dialouge dialouge, GameObject investigate) { nameText.text = dialouge.name; player.GetComponentInChildren <Canvas>().enabled = true; sentences.Clear(); foreach (string sentence in dialouge.getSentences()) { sentences.Enqueue(sentence); } started = true; DisplayInvNextSentence(investigate); }
public void StartDialouge(Dialouge dialouge) { animator.SetBool("IsOpen", true); nameText.text = dialouge.name; sentences.Clear(); foreach (string sentence in dialouge.sentences) { sentences.Enqueue(sentence); } DisplayNextSentence(); }
public void StartDialouge(Dialouge dialoue) { nameText.text = dialoue.name; sentences.Clear(); foreach (string sentence in dialoue.sentecnes) { sentences.Enqueue(sentence); } DisplayNextSentence(); }
public void Begin(Dialouge info) { anim.SetBool("isOpen", true); sentences.Clear(); txtName.text = info.name; foreach (var sentence in info.sentences) { sentences.Enqueue(sentence); } Next(); }
public void StartDialouge(Dialouge dialouge) { //make sure queue is clear Sentences.Clear(); //fill queue foreach (string sentence in dialouge.Text) { Sentences.Enqueue(sentence); } //activate UI and start print sentences NPCName.text = dialouge.name; TextActive = true; DisplayNextSentence(); }
public void StartDialogue(Dialouge dialouge, Sprite image) { profile.sprite = image; dialogHolder.SetActive(true); anim.SetBool("IsOpen", true); nameText.text = dialouge.name; sentenses.Clear(); foreach (string sentences in dialouge.sentenses) { sentenses.Enqueue(sentences); } DisplayNextSentense(); }
void LoadDialouge(string fileName) //Normal loadDialouge //lineCounter = 0; { diaFile = new Dialouge(fileName); //First dialougeFile to be read. if (Application.platform == RuntimePlatform.Android) //If running on android { } else { lines = diaFile.getDialougeLine(); } //if (!checkLoadedFile (fileName)) { //If new file to be loaded //No longer needed 03 May 2017 // loadedDialougeFile.Add (diaFile); //} }
public void StartDialouge(Dialouge dialouge) { //Starts the animation animator.SetBool("IsOpen", true); //Gets the name of NPC nameText.text = dialouge.name; sentences.Clear(); //Put all scentences in a queue foreach (string sentence in dialouge.sentences) { sentences.Enqueue(sentence); } DisplayNextSentence(); }
public void StartDialouge(Dialouge dialouge) { Time.timeScale = 0; Debug.Log("Start conversation with " + dialouge.name); nameText.text = dialouge.name; sentences.Clear(); foreach (string sentence in dialouge.sentences) { sentences.Enqueue(sentence); } DisplayNextSentence(); }
private void Start() { using (StreamReader reader = new StreamReader("Dialouge.json")) { string dialougeFromJson = reader.ReadToEnd(); this._dialouge = JsonUtility.FromJson <Dialouge>(dialougeFromJson); reader.Close(); _buttons[0].text = _dialouge.Answers.A; _buttons[1].text = _dialouge.Answers.B; _buttons[2].text = _dialouge.Answers.C; _buttons[3].text = _dialouge.Answers.D; _Answer.text = _dialouge.Question; } }
//starts the dialouge public void StartDialouge(Dialouge dialouge) { nameText.text = dialouge.name; //makes the dialouge bar visible dialougeBack.SetActive(true); //clears sentences that may still be active sentences.Clear(); //enques all sentences: for the purpose of interacting with object only one sentence is active, but for further purposes this was not deleted //(for example communitcation with an npc that requires more sentences) foreach (string sentence in dialouge.getSentences()) { sentences.Enqueue(sentence); } started = true; DisplayNextSentence(); }
void Update() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000)) { if (hit.collider.tag == "NPC") { Dialouge trig = hit.collider.gameObject.GetComponent <Dialouge>(); Debug.Log("NPC hit"); TriggerDialouge(trig); } } } }
public void StartDialogue(Dialouge dialouge) { dialoguePanel.SetActive(true); //Copy sentences from dialog currentDialogSentences = dialouge.sentences.ToArray(); nameText.text = dialouge.characterName; foreach (Sentence sentence in currentDialogSentences) { sentences.Enqueue(sentence); } if (sentences.Count > 0) { dialogueContinue.text = "Continue... [E]"; } if (!isActiveDialogue) { DisplayNextSentence(); } isActiveDialogue = true; }
private void Update() { this.transform.position = pos; if (Input.GetKeyDown(KeyCode.E)) { if (Horizontal) { if (player.transform.position.y > this.transform.position.y && Rotated == false) { rb.freezeRotation = false; rb.AddForce(new Vector2(0, -1)); dia = new Dialouge("Door open"); read = new ReadText("knife"); Rotated = true; } /*if (Rotated == true) * { * rb.freezeRotation = true; * this.transform.rotation = Quaternion.Euler(0, 0, 0); * }*/ } } }
// Update is called once per frame void Update() { if (!fadedIn) { // Fade to screen float theAlpha = blackScreen.GetComponent <SpriteRenderer>().color.a - Time.deltaTime; if (theAlpha < 0) { theAlpha = 0; } speech.color = new Color(1 - theAlpha, 1 - theAlpha, 1 - theAlpha); blackScreen.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, theAlpha); if (theAlpha == 0) { fadedIn = true; } } // Preform an action until it's done, then move onto the next if (curAction < actionList.Length) { switch (actionList[curAction].getAct()) { case npcAction.TALK: Event.Talk curTalk = actionList[curAction].getTalk(); Dialouge dia = getDia(curTalk); if (dia.isDone()) { dia.resetDia(); delDia(); curAction++; showDisp(); } else { if (Input.GetKeyDown(DataManager.savedOptions.controls[(int)key.B1])) { if (dia.getReadingLine(dia.getLine(), textSpd) == dia.getLine()) { dia.nextLine(); if (!dia.isDone()) { duckSprite[curTalk.duck].GetComponent <SpriteRenderer>().sprite = dia.getSprite(); if (curTalk.animMe != null) { curTalk.animMe.GetComponent <SpriteRenderer>().sprite = dia.getSprite(); } } } else { speech.text = curTalk.name + ": " + dia.getLine(); dia.endLineRead(); } } else { speech.text = curTalk.name + ": " + dia.getReadingLine(dia.getLine(), textSpd); // Play talking sound effect if (dia.IsNewChar()) { mainSFX.GetComponent <AudioSource>().clip = talking[(int)Random.Range(0, talking.Length - 1)]; mainSFX.GetComponent <AudioSource>().pitch = dia.getPitch(); mainSFX.GetComponent <AudioSource>().Play(); } } } break; case npcAction.WALK: Event.Walk curWalk = actionList[curAction].getWalk(); if (moveToTarget(curWalk.walker, curWalk.spot, curWalk.speed)) { curAction++; showDisp(); } else if (curWalk.walker.GetComponent <SpriteRenderer>() != null) { UpdateSprite(curWalk.walker, curWalk.anim, curWalk.fps); } break; case npcAction.ANIM: Event.Anim curAnim = actionList[curAction].getAnim(); if (WaitForXFrames(curAnim.frameAmt)) { curAction++; showDisp(); } else { UpdateSprite(curAnim.animated, curAnim.anim, curAnim.fps); } break; case npcAction.TURN: Event.Turn curTurn = actionList[curAction].getTurn(); curTurn.turner.GetComponent <SpriteRenderer>().sprite = curTurn.theTurn; if (curTurn.flip) { curTurn.turner.transform.localScale = new Vector2(-curTurn.turner.transform.localScale.x, curTurn.turner.transform.localScale.y); } curAction++; showDisp(); break; case npcAction.ENCOUNTER: Event.Encounter curEnc = actionList[curAction].getEnc(); // Play encounter music if (blackScreen.GetComponent <SpriteRenderer>().color.a == 0) { mainSFX.GetComponent <AudioSource>().clip = encMusic; mainSFX.GetComponent <AudioSource>().Play(); } // Fade to black float theAlpha = blackScreen.GetComponent <SpriteRenderer>().color.a + Time.deltaTime; if (theAlpha > 1) { theAlpha = 1; } // Fade text speech.color = new Color(1 - theAlpha, 1 - theAlpha, 1 - theAlpha); blackScreen.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, theAlpha); if (theAlpha == 1) { if (newPos) { TitleManager.curFile.setLocation(xPos, yPos); } TitleManager.curFile.setScene(nextScene); string foeSetDataPath = curEnc.enemySet; TextAsset set = Resources.Load <TextAsset>(@foeSetDataPath); GameProgress.jankFile setTxt = new GameProgress.jankFile(set); TitleManager.curFile.setEnemySet(readFoes(setTxt)); TitleManager.curFile.setBackground(curEnc.background); TitleManager.curFile.setSound(curEnc.battleMusic); SceneManager.LoadScene("BattleScene", LoadSceneMode.Single); } break; case npcAction.SAVE: saveFile(); curAction++; break; case npcAction.TITLE: if (newPos) { TitleManager.curFile.setLocation(xPos, yPos); } TitleManager.curFile.setScene(nextScene); saveFile(); SceneManager.LoadScene("TitleScreen", LoadSceneMode.Single); curAction++; break; case npcAction.PLAYSFX: mainSFX.GetComponent <AudioSource>().clip = actionList[curAction].playSFX; mainSFX.GetComponent <AudioSource>().Play(); curAction++; break; default: break; } } // Load the next scene else { // Fade to black float theAlpha = blackScreen.GetComponent <SpriteRenderer>().color.a + Time.deltaTime; if (theAlpha > 1) { theAlpha = 1; } // Fade text speech.color = new Color(1 - theAlpha, 1 - theAlpha, 1 - theAlpha); blackScreen.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, theAlpha); if (theAlpha == 1) { DungeonHandler.curState = gameState.OVERWORLD; DungeonHandler.preState = gameState.DIALOUGE; SceneManager.LoadScene(nextScene, LoadSceneMode.Single); } } }
public void TriggerDialouge(Dialouge t) { FindObjectOfType <DialougeManager>().StartDialogue(t); }
void Start() { // Move player to last spot player.transform.localPosition = new Vector2(TitleManager.curFile.getXPos(), TitleManager.curFile.getYPos()); // Hide dialouge stuff textbox.GetComponent <SpriteRenderer>().enabled = false; duckSprite.GetComponent <SpriteRenderer>().enabled = false; speech.enabled = false; curEntity = -1; purchaseAmt = 1; // Hide shop stuff DisplaySprite(shopDisplay, false); itemIcon.GetComponent <SpriteRenderer>().enabled = false; statDisp.GetComponent <SpriteRenderer>().enabled = false; itemName.enabled = false; itemDes.enabled = false; itemAmt.enabled = false; balance.enabled = false; curBal.enabled = false; DisplayText(itemStat, false); DisplayText(itemCost, false); DisplayText(itemDisp, false); // Load in all text and sprite as dialouge this.curSpeech = new Dialouge[ducks.Length]; for (int i = 0; i < curSpeech.Length; i++) { curSpeech[i] = new Dialouge(ducks[i].dialouge, ducks[i].image, ducks[i].pitch); } // Use the main camera at this point main.enabled = true; // Set encounter variables curSteps = 0; encounter = Random.Range(100, 700); // Read in set of foes TextAsset set = Resources.Load <TextAsset>(@foeSetDataPath); GameProgress.jankFile setTxt = new GameProgress.jankFile(set); readFoes(setTxt); // Open any opened chests for (int i = 0; i < ducks.Length; i++) { if (ducks[i].type == npcType.CHEST) { if (TitleManager.curFile.getFlag(ducks[i].chestID)) { if (entity[i].GetComponent <NPC>() != null) { entity[i].GetComponent <NPC>().openChest(); } } } } stopMoving = false; }
public void startDialouge(Dialouge dialouge) { state = State.Talking; this.dialogue_Controler.Start_dialogue(dialouge); }
// Use this for initialization void Start () { dialouge = GameObject.Find("DialougeField").GetComponent<Dialouge>(); }
void Start() { Dialouge dialouge = this.GetComponent <Dialouge>(); baniak.startDialouge(dialouge); }