//! Every frame, checks for space press and passes a message if an NPC is in range. void Update() { if (Input.GetKeyDown(KeyCode.Space)) { NPC n = GetNearbyNPC(); if (n != null) { StoryManager.GetCurrentDialogueForPerson(n.person); MessagePasser.OnNPCSpokenTo(n); // Show the dialogue UI CurrentDialogue = StoryManager.instance.GetCurrentDialogueForPerson(n.person); UIController.SetDialogueBoxText(CurrentDialogue["NO_TOPIC"]); Debug.Log("Dialogue for: " + n.person); foreach (string topic in CurrentDialogue.Keys) { Debug.LogFormat("{0}: {1}", topic, CurrentDialogue[topic]); } InitialiseInteraction(); UIController.SetNPC(n); } else { Debug.Log("No NPC found"); } MessagePasser.OnPlayerPressSpacebar(); } }