/** * Called when the player character comes into the 'zone' * of an npc with a talk dialogue */ void OnTriggerEnter(Collider colide) { if (colide.gameObject.tag == "Player") { //freeze mouse-look firstPerson = colide.gameObject.GetComponent<FirstPersonController> (); firstPerson.setInDialogueToggle(); if(firstPerson.isPlayerDirty()){ //Initialize conversation values. //must be the same length each for this simple dialogue exchange NPCTalk[0] = "What do you want, ruffian"; NPCTalk[1] = "I don't talk to scruffy vagrants"; NPCTalk[2] = "I only converse with clean people"; NPCTalk[3] = ""; PCTalk[0] = "I wonder if you can help.."; PCTalk[1] = "Please .. have you seen a book.."; PCTalk[2] = "I must need to wash-up then hmm.."; PCTalk [3] = ""; } else{ NPCTalk[0] = "Ah you have cleaned yourself up"; NPCTalk[1] = "So what was it you wanted"; NPCTalk[2] = "I think i saw one near the gallery"; NPCTalk[3] = ""; PCTalk[0] = "Yes I feel better now"; PCTalk[1] = "im looking for an old book.."; PCTalk[2] = "OK thank you"; PCTalk [3] = ""; } Debug.Log("met player"); myTalking = true; PauseGame (); } }