Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class NPC : MonoBehaviour {
- public GameObject npcUI;
- public PlayerManager playerManager;
- void Start () {
- npcUI.SetActive(false);
- }
- void Update () {
- }
- public void OnTriggerEnter2D(Collider2D other)
- {
- if(other.gameObject.tag == "Player")
- {
- npcUI.SetActive(true);
- }
- }
- public void OnTriggerExit2D(Collider2D collision)
- {
- if (collision.gameObject.tag == "Player")
- {
- npcUI.SetActive(false);
- }
- }
- public void buySpeed()
- {
- playerManager.speed += 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement