void NxtMsg() { Debug.Log("NxtMsg"); if (msgQueue.Count > 0 && !waiting) { instance.StartCoroutine(WaitTime(waitingTime)); Debug.Log("msgQueue.Count > 0"); DialogMeta dialog = msgQueue.Dequeue(); GameObject.Find("DialogText").GetComponent <Text>().text = dialog.msgNoTags(); if (dialog.getHeal()) { Debug.Log("Heal"); //AdventureMeta meta = GameObject.FindWithTag("Player").GetComponent<PlayerMain>().playerMeta; //meta.trainer = null; ////meta.playerPos = new PosMeta(GameObject.Find("PlayerHero").transform.position); //foreach(PlayerRosterMeta monster in meta.roster){ // monster.curHealth = monster.maxHealth; //} //BaseSaver.putAdventure(meta); //BaseSaver.putBoard(GameUtilities.getBoardState(BaseSaver.getMap(), new PosMeta(GameObject.FindWithTag("Player").transform.position))); //BaseSaver.saveState(); StartCoroutine(HealSave()); instance.StartCoroutine(HealFlash()); // Flash the screen right here } else if (dialog.getFight()) { Debug.Log("Fight"); instance.StartCoroutine(FightFlash(true)); } else if (dialog.getShop()) { ShopCanvas.SetActive(true); PopulateShop(); } } else if (msgQueue.Count > 0 && waiting) { Debug.Log("Waiting"); } else { //DialogCanvas.SetActive(false); StartCoroutine(WaitSetInactive()); } }
public DialogMeta(DialogMeta meta) { this.msg = meta.msg; }
void OnTriggerEnter2D(Collider2D other) { Debug.Log("Other Checking: " + other.name); if (tag.Equals("Player")) { Debug.Log("Other Checking: " + other.name); Debug.Log("Has Dialog: " + DialogManager.instance.hasDialog().ToString()); Debug.Log("other.name.Contains(NPC_Trainer): " + other.name.Contains("NPC_Trainer").ToString()); if (!waitingForConversation) { if (other.tag.Contains("Item") && !DialogManager.instance.hasDialog()) { DialogMeta[] diag = new DialogMeta[1]; diag[0] = new DialogMeta("Received: " + other.name + "\n" + other.GetComponent <TreasureMain>().monTreas.description); DialogManager.instance.SetMsgs(other.gameObject.GetComponent <SpriteRenderer>().sprite, diag); StartCoroutine(SaveItem(other.gameObject)); GameObject.FindWithTag("Player").GetComponent <PlayerMain>().playerMeta = BaseSaver.getAdventure(); StartCoroutine(DestWait(other)); } if (other.tag.Contains("Signpost") && !DialogManager.instance.hasDialog()) { DialogManager.instance.SetMsgs(other.gameObject.GetComponent <SpriteRenderer>().sprite, other.gameObject.GetComponent <SignDialog>().dialogs); } if (other.name.Contains("NPC_WhiteMage") && !DialogManager.instance.hasDialog()) { //Debug.Log("NPC_WhiteMage"); //NPCMeta meta = other.gameObject.GetComponent<NPCMain>().meta; NPCMeta npcmeta = other.gameObject.GetComponent <NPCMain>().meta; npcmeta.talkedTo = true; DialogManager.instance.SetMsgs(other.gameObject.GetComponent <SpriteRenderer>().sprite, other.gameObject.GetComponent <NPCMain>().meta.dialogs); } if (other.name.Contains("NPC_Trainer") && !DialogManager.instance.hasDialog()) { Debug.Log("Other Collided: " + other.name); NPCMeta npcmeta = other.gameObject.GetComponent <NPCMain>().meta; if (npcmeta.dialogs.Length > 0) { Debug.Log("Dialogs good"); npcmeta.talkedTo = true; if (npcmeta.lookDistance > 0 && !npcmeta.defeated) { other.gameObject.GetComponent <NPCMain>().moveToPos(transform.position); } else if (npcmeta.trainer && !npcmeta.defeated) { other.gameObject.GetComponent <NPCMain>().startleNPC(); } StartCoroutine(SaveConversation(other.gameObject)); //AdventureMeta meta = BaseSaver.getAdventure(); ////meta.playerPos = new PosMeta(transform.position); //NPCMain trainerMain = other.gameObject.GetComponent<NPCMain>(); //if (trainerMain.meta.infiniteTrainer) { // meta.trainer = trainerMain.getInfiniteMeta(meta); //} else { // meta.trainer = trainerMain.getRefinedMeta(); //} //meta.trainer.pos = new PosMeta(other.gameObject.transform.position); //meta.wild = null; //meta.isTrainerEncounter = true; //Debug.Log(meta.ToString()); //Debug.Log(meta.trainer.ToString()); //BaseSaver.putAdventure(meta); //BaseSaver.putBoard(GameUtilities.getBoardState(BaseSaver.getMap(), new PosMeta(transform.position))); //BaseSaver.saveState(); if (npcmeta.canFight) { Debug.Log("Can Fight"); DialogManager.instance.SetMsgs(other.gameObject.GetComponent <SpriteRenderer>().sprite, other.gameObject.GetComponent <NPCMain>().meta.defeated ? other.gameObject.GetComponent <NPCMain>().meta.defeatedDialogs : other.gameObject.GetComponent <NPCMain>().meta.dialogs ); } else { DialogMeta d1 = new DialogMeta("The stars have not yet aligned for us to battle."); DialogMeta d2 = new DialogMeta("Perhaps we will meet each other again..."); DialogMeta[] comeAgainDialog = { d1, d2 }; DialogManager.instance.SetMsgs(other.gameObject.GetComponent <SpriteRenderer>().sprite, comeAgainDialog); } } } if (other.name.Contains("ExitTileGrass")) { GameManager.instance.FadeOutNoScene(); waitingForRoll = true; StartCoroutine(WaitForAction(roll_wait)); StartCoroutine(WaitForConversation(convo_wait)); BaseSaver.putBoard(GameUtilities.getBoardState(BaseSaver.getMap(), new PosMeta(transform.position))); other.gameObject.GetComponent <ExitTile>().loadSteppedScene(); } } else { Debug.Log("Waiting for roll"); } } }