File size: 540 Bytes
dfdb6c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;

public class Key : MonoBehaviour, IInteractable
{
    public KeyCode keyCode = KeyCode.E;
    public Sprite keySprite;
    public void interact()
    {
        Debug.Log("Interact!");
    }

    public Sprite GetSprite()
    {
        return keySprite;
    }

    public bool CanInteract()
    {
        return (Input.GetKeyDown(keyCode));
    }

    public Transform GetHandle()
    {
        return gameObject.transform;
    }
}