void OnTriggerEnter2D(Collider2D otherCollider) { if (otherCollider.gameObject.tag == "Player") { // node = otherCollider.gameObject.GetComponent<NodeRule>(); GameObject go = GameObject.FindGameObjectWithTag("Player"); go.GetComponent <PlayerScript>().food++; GameObject.FindGameObjectWithTag("Main").GetComponent <DialogueManager>().StartDialogue(DialogueGenerator.GeneratePositive(), gameObject); //Do dialogue "Thanks, your smile makes mer feel real."; } }
// Update is called once per frame void Update() { if (main.GetComponent <DialogueManager>().IsInDialogue()) { return; } if (Input.GetKeyDown(KeyCode.Space)) { if (this.activeObject != null) { activeObject.GetComponent <AITest>().BroadcastMessage("Pause"); GameObject.FindGameObjectWithTag("Main").GetComponent <DialogueManager>().StartDialogue(DialogueGenerator.GeneratePositive(), activeObject); } } float x = Input.GetAxis("Horizontal") * moveSpeed * Time.deltaTime; float y = Input.GetAxis("Vertical") * moveSpeed * Time.deltaTime; GetComponent <CharacterController>().Move(new Vector3(x, y, 0)); }