/// <summary> /// Check the rules and put it into rpgtalkTarget, initializing a new talk. /// </summary> protected virtual void NewTalk() { if (rpgtalkTarget == null || (happenOnlyOnce && alreadyHappened) || (forbidPlayIfRpgtalkIsPlaying && rpgtalkTarget.isPlaying)) { return; } alreadyHappened = true; if (callbackScriptBeforeTalk != null) { callbackScriptBeforeTalk.Invoke(callbackFunctionBeforeTalk, 0); } TextAsset newTxt = rpgtalkTarget.txtToParse; if (txtToParse != null) { newTxt = txtToParse; } rpgtalkTarget.shouldStayOnScreen = shouldStayOnScreen; if (callbackScriptAfterTalk == null) { rpgtalkTarget.NewTalk(lineToStart, lineToBreak, newTxt); } else { rpgtalkTarget.NewTalk(lineToStart, lineToBreak, newTxt, callbackScriptAfterTalk, callbackFunctionAfterTalk); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Return)) { rpgTalk.EndTalk(); } //if the player hits E, check if it is talking with someone if (Input.GetKeyDown(KeyCode.E)) { if (touching == "NPC") { controls = false; rpgTalk.lineToStart = 15; rpgTalk.lineToBreak = 16; rpgTalk.callbackFunction = "WhoAreYou"; rpgTalk.NewTalk(); } if (touching == "Girl") { controls = false; rpgTalk.lineToStart = 33; rpgTalk.lineToBreak = -1; rpgTalk.callbackFunction = "GiveBackControls"; rpgTalk.shouldStayOnScreen = true; rpgTalk.NewTalk(); } } }
void OnMadeChoice(int questionID, int choiceNumber) { if (questionID == 2) { if (choiceNumber == 0) { if (rpgCaveG.isPlaying == false) { talkedToGuard = true; GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; rpgCaveG.NewTalk("5", "5"); lastPressed = 0.0f; } else if (rpgCaveG.isPlaying == false) { } } else if (choiceNumber == 1) { if (rpgCaveG.isPlaying == false) { GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; rpgCaveG.NewTalk("7", "7"); lastPressed = 0.0f; } } } }
void OnMadeChoice(int questionID, int choiceID) { if (questionID == 0) { if (choiceID == 0) { if (rpgCaptainAnderson.isPlaying == false) { rpgCaptainAnderson.NewTalk("5", "9"); talkedToAnderson = true; lastPressed = 0.0f; GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; } } else if (choiceID == 1) { if (rpgCaptainAnderson.isPlaying == false) { talkedToAnderson = true; rpgCaptainAnderson.NewTalk("11", "15"); lastPressed = 0.0f; GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; } } } }
private void dealWithWeathermanTalk(int choiceID) { string option = choiceID.ToString(); rpgtalk.NewTalk("weatherman-option-" + option + "-picked-start", "weatherman-option-" + option + "-picked-end"); }
void OnTriggerStay2D(Collider2D other) { if (lastPressed != Time.deltaTime) { if (Input.GetButtonDown("Fire1") || Input.GetKeyUp(KeyCode.F)) { if (rpgPatch.isPlaying == false) { if (GameObject.Find("Father").GetComponent <FatherGallhager> ().gotCure == false) { lastPressed = Time.deltaTime; talkedToPatches = true; GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; rpgPatch.NewTalk("1", "7"); } else if (GameObject.Find("Father").GetComponent <FatherGallhager> ().gotCure == true) { lastPressed = Time.deltaTime; GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; rpgPatch.NewTalk("9", "10"); } } } } }
void OnTriggerStay2D(Collider2D other) { if (lastPressed != Time.deltaTime) { if (Input.GetButtonDown("Fire1") || Input.GetKeyUp(KeyCode.F)) { if (rpgKnee.isPlaying == false) { if (GameObject.Find("Guard").GetComponent <CaveGuard> ().talkedToGuard == true) { lastPressed = Time.deltaTime; GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; rpgKnee.NewTalk("3", "5"); talkedToKnight = true; } else if (GameObject.Find("Guard").GetComponent <CaveGuard> ().talkedToGuard == false) { lastPressed = Time.deltaTime; GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; rpgKnee.NewTalk("1", "1"); } } } } }
void LateUpdate() { //print(bulletHearts); if (inTown == true) { //Vector3 camPos = transform.position; // camPos.z += offset.z; // mainCam.transform.position = camPos; GameObject.FindGameObjectWithTag("Score").GetComponent <TextMesh>().text = ""; GameObject.FindGameObjectWithTag("EnemiesRemaining").GetComponent <TextMesh>().text = ""; if (touching == "NPC(Clone)") { if (Input.GetKeyDown("space") && isTalking == false) { townButton.SetActive(false); eatButton.SetActive(false); isTalking = true; rpgTalk.lineToStart = currNPC.GetComponent <NPCBehavior>().dialogueSection; rpgTalk.lineToBreak = currNPC.GetComponent <NPCBehavior>().dialogueSection; rpgTalk.NewTalk(); controls = false; rpgTalk.callbackFunction = "GiveBackControls"; } } } }
public void PickRandomLine() { CancelControls(); System.Random pseudoRandom = new System.Random(Time.time.ToString().GetHashCode()); int rand = pseudoRandom.Next(lineMin, lineMax); string line = rand.ToString(); rpgTalk.NewTalk(line, line, rpgTalk.txtToParse, this, "GiveBackControls"); }
public void IntroDialog() { GameController.PauseGame(true); RpgTalk.lineToStart = 2; RpgTalk.lineToBreak = 3; RpgTalk.callbackScript = this; RpgTalk.callbackFunction = "GetPlayerName"; RpgTalk.NewTalk(); }
public void IKnowYouNow() { askwho.SetActive (false); rpgTalk.variables [0].variableValue = name.text; rpgTalk.lineToStart = 55; rpgTalk.lineToBreak = 58; // rpgTalk.callbackFunction = "ByeWall"; rpgTalk.callbackFunction = "GiveBackControls"; rpgTalk.NewTalk (); }
void QuestBehavior(Quest temp) { //when edward gets saved if (temp == neededQuest) { anim.SetTrigger(animTrigger); if (rpgTalk != null) { rpgTalk.NewTalk(startLine, endLine, callBackScript, functionName); } } }
public void SwitchPillarState() { int dungeonState = gameManager.dungeonsState[dungeonID]; if (dungeonState == 0 || dungeonState == 1) { rpgTalk.NewTalk("1", "2", rpgTalk.txtToParse, this, "FlagDungeonWithEvilWand"); } if (dungeonState == 2 || dungeonState == 3) { rpgTalk.NewTalk("3", "3", rpgTalk.txtToParse, this, "UnflagDungeonWithEvilWand"); } }
void OnTriggerStay2D(Collider2D other) { if (Input.GetButtonDown("Fire1") || Input.GetKeyUp(KeyCode.F)) { if (GameObject.Find("KneelKnight").GetComponent <KneelKnight> ().talkedToKnight == true) { PressF.enabled = false; TrueVictoryCanvas.enabled = true; trueVicExtraCreditsButton.interactable = true; trueVicExitGameButton.interactable = true; StartCoroutine("trueVicSelect"); Time.timeScale = 0.0f; } else if (GameObject.Find("KneelKnight").GetComponent <KneelKnight> ().talkedToKnight == false) { if (gotCure == true) { PressF.enabled = false; VictoryCanvas.enabled = true; vicExtraCreditsButton.interactable = true; vicExitGameButton.interactable = true; StartCoroutine("vicSelect"); Time.timeScale = 0.0f; } else if (gotCure == false) { if (lastPressed != Time.deltaTime) { if (GameObject.Find("CaptainAnderson").GetComponent <CaptainAnderson> ().talkedToAnderson == true) { PressF.enabled = false; lastPressed = Time.deltaTime; GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; rpgFather.NewTalk("1", "4"); } else if (GameObject.Find("CaptainAnderson").GetComponent <CaptainAnderson> ().talkedToAnderson == false) { PressF.enabled = false; lastPressed = Time.deltaTime; GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; rpgFather.NewTalk("6", "6"); } } } } } }
// Start is called before the first frame update void Start() { GameObject sc = GameObject.FindWithTag("StoryController"); if (sc != null) { storyController = sc.GetComponent <StoryController>(); } if (sc == null || storyController == null || storyController.StoryStage != StoryController.STAGE_GET_ARROW) { Debug.Log("StoryGetArrow detected missing elements, deleting"); this.gameObject.SetActive(false); arrowItem.SetActive(false); return; } else { Debug.Log("Initializing Story Get arrow stage"); exitDoor.gameObject.SetActive(false); GameObject playerObj = GameObject.FindWithTag("Player"); player = playerObj.GetComponent <PlayerMovement>(); player.transform.position = playerStart.transform.position; //Play intro cutscene player.lockedControls = true; levelMasterTalk.OnEndTalk += OnCutsceneEnd; levelMasterTalk.NewTalk("IntroCutscene", "IntroCutsceneE"); } }
void LateUpdate() { if (GameController.Instance.death) { player.transform.position = checkpoint.transform.position; CancelControls(); player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; deathTalk.NewTalk("deathStart", "deathEnd", deathTalk.txtToParse); player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation; GameController.Instance.death = false; if (!diedAlready) { Tcell.GetComponent <TcellPatrol>().points = largerPatrol; Tcell.GetComponent <TcellPatrol>().destPoint = 0; } diedAlready = true; } if (!endPlayed && tutCell.GetComponentInChildren <CellCapture>().capped) { CancelControls(); endMenu.SetActive(false); Time.timeScale = 1.0f; endTalk.NewTalk("endLevelStart", "endLevelEnd", endTalk.txtToParse); endPlayed = true; } }
// Start is called before the first frame update void Start() { switch ((int)GameManager.instance.stateMachine.state) { case (int)GameManager.State.Beginning: player.transform.position = beginningPosition; player.transform.Rotate(playerRotation); ActivateCanvas(0); break; case (int)GameManager.State.TalkedToPersonOnCouch: // show UI text for telling player to go cook food ActivateCanvas(1); break; case (int)GameManager.State.CompletedFoodResultCutscene: player.transform.position = endPosition; player.transform.Rotate(playerRotation); // show UI text for telling player to go to sleep ActivateCanvas(2); break; default: Debug.Log("used a value out of range."); break; } Debug.Log(GameManager.instance.currentStoryTextStartLine + ", " + GameManager.instance.currentStoryTextEndLine); dialogueController.NewTalk(GameManager.instance.currentStoryTextStartLine, GameManager.instance.currentStoryTextEndLine, dialogueController.txtToParse, this, "DisableDialogueCanvas"); dialogueCanvas.gameObject.SetActive(false); }
void LateUpdate() { if (GameController.Instance.death && !deathPlayed) { deathPlayed = true; PlayerCanvas.SetActive(false); CancelControls(); TargetDestroyedDeath.text = GameController.Instance.numCaptures.ToString() + " / " + GameController.Instance.numCellsInLevel.ToString(); float timeLeft = Time.timeSinceLevelLoad; int min = Mathf.FloorToInt(timeLeft / 60); int sec = Mathf.FloorToInt(timeLeft % 60); TimeSpentDeath.text = min.ToString("00") + ":" + sec.ToString("00"); player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; player.GetComponent <Collider>().enabled = false; player.gameObject.GetComponentInChildren <Renderer>().enabled = false; deathTalk.NewTalk("deathStart", "deathEnd", deathTalk.txtToParse); } if (!endPlayed && GameController.Instance.numCaptures == GameController.Instance.numCellsInLevel) { CancelControls(); endMenu.SetActive(false); Time.timeScale = 1.0f; endTalk.NewTalk("endLevelStart", "endLevelEnd", endTalk.txtToParse); endPlayed = true; } }
public void NewRandomTalk() { int lineStart = Random.Range(1, TEXTFILELINECOUNT); int lineBreak = lineStart + 1; _rpgt.NewTalk(lineStart.ToString(), lineBreak.ToString()); }
private void OnMouseUp() // begin conversation { if (!myTalk.dialogerObj.activeInHierarchy && !gm.locked) { myTalk.variables[0].variableValue = myName; myTalk.NewTalk("4", "6"); } }
void OnMadeChoice(int questionId, int choiceID) { if (choiceID == 0 && questionId == 0) { rpgtalk.NewTalk("question_0_start", "question_0_end"); Debug.Log("SAN值减1"); } }
//touching who? void OnTriggerEnter2D(Collider2D col) { touching = col.name; if (touching == "startFollow") { rpgTalkToFollow.NewTalk(); } }
public void StartTalking() { if (!isTalking) { talk.NewTalk("flevel_start", "flevel_end"); isTalking = true; } }
/// <summary> /// 交互时被动方使用的方法 /// </summary> /// <param name="calling">调用事件时的主动方</param> public void OnCall(GameObject calling) { inEvent = true; Events callingEvent = calling.GetComponent <Events>(); switch (gameObject.name) { case "Passerby": SetFaceOrientation(-callingEvent.faceOrientation); CreateTemporaryNPC(temporaryNPC, "路人", eventSprites[0]); rpgTalkHolder.NewTalk("1", "2"); break; case "TestBox": rpgTalkHolder.NewTalk("1", "1"); break; case "TestArea": rpgTalkHolder.NewTalk("2", "2"); break; case "BestArmor": rpgTalkHolder.NewTalk("1", "1"); break; case "BestSword": rpgTalkHolder.NewTalk("2", "2"); break; case "SceneMove01": au.PlayOneShot(sceneChangeSound); switch (SceneManager.GetActiveScene().name) { case "GrassLand": gameManager.StartCoroutine("ChangeScene", "Store"); break; case "Store": gameManager.StartCoroutine("ChangeScene", "GrassLand"); break; } break; } }
void OnTriggerEnter2D(Collider2D col) { touching = col.name; if(touching == "AlgaRafi"){ rpgTalkToFollow.NewTalk (); } if (touching == "PGameLevel1" && GameManager.Level==0) { Application.LoadLevel("game"); } }
public void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { if (rpgtalk != null) { rpgtalk.NewTalk(); } } }
void LateUpdate() { if (!endPlayed && cell.GetComponentInChildren <CellCapture>().capped) { CancelControls(); endMenu.SetActive(false); Time.timeScale = 1.0f; endTalk.NewTalk("endLevelStart", "endLevelEnd", endTalk.txtToParse); endPlayed = true; } }
void LateUpdate() { if (!endPlayed && GameController.Instance.numCaptures == GameController.Instance.numCellsInLevel) { CancelControls(); endMenu.SetActive(false); Time.timeScale = 1.0f; endTalk.NewTalk("endLevelStart", "endLevelEnd", endTalk.txtToParse); endPlayed = true; } }
IEnumerator cameraPan() { CancelControls(); grayScreen.enabled = false; yield return(new WaitForSeconds(2)); zoomedOutCam.SetActive(false); yield return(new WaitForSeconds(2)); grayScreen.enabled = true; IntroTalk.NewTalk("IntroTalkStart", "IntroTalkEnd", IntroTalk.txtToParse); }
void StartDialogue(RPGTalk dialogue) { // RPGTalk doesn't like multiple RPGTalk instances using the same // dialogue text instance. So we need to ensure all other dialogues are // stopped before starting this new one. StopDialogue(dialogueIntroduction); StopDialogue(dialogueBetweenLevels); StopDialogue(dialogueIntroduction); dialogue.gameObject.SetActive(true); dialogue.NewTalk(); }