Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum CHEST {LOCKED, OPEN};
- private CHEST myChest = CHEST.LOCKED;
- private Animator anim;
- private Interactor ic;
- private GameManager gm;
- private GameObject key;
- public TextHints th;
- public GameObject potion;
- // Use this for initialization
- void Start () {
- anim = transform.parent.GetComponent<Animator>();
- ic = GetComponent<Interactor>();
- gm = GetComponent<GameManager>();
- key = GameObject.Find("KeyAtLock");
- }
- // Update is called once per frame
- void Update () {
- }
- private void OnMouseDown()
- {
- if(ic.WithinRange())
- {
- if (GameManager.HaveKey == true)
- {
- transform.parent.GetChild(2).gameObject.SetActive(true);
- anim.SetBool("OpenChest", true);
- myChest = CHEST.OPEN;
- Invoke("delay", 1);
- }
- else
- {
- print("Find a key");
- th.DisplayHint2();
- }
- }
- else
- {
- anim.SetBool("OpenChest", false);
- myChest = CHEST.LOCKED;
- }
- }
- private void delay()
- {
- potion.SetActive(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement