Ejemplo n.º 1
0
    // private void Start() {
    //     for (int i=0;i<attachedScripts.Length;++i) {
    //         if (attachedScripts[i].dialogue != null) {
    //             Debug.Log(attachedScripts[i]);
    //             itemScript = attachedScripts[i];
    //         }
    //     }
    // }

    public void Interact()
    {
        Debug.Log("Interacted");
        // check if theres player within radius
        float distance = Vector3.Distance(player.position, interactableObject.position);

        Debug.Log(distance + " - " + radius);
        if (distance <= radius)    // how to create new instance of class interactable - it stays with the first one idk
        {
            Debug.Log("Before activated");
            itemScript.Activate();
        }
    }