File size: 1,083 Bytes
c80142e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
using UnityEngine;

public class InteractHandler : MonoBehaviour
{
    [Copyable] public bool interactable = true;
    [TextArea] public string tooltipText = "Press E to interact";
    [Copyable] public Objective ObjectiveProgress;
    [Copyable] public Objective ObjectiveStart;

    public virtual void InteractLogic()
    {
        if (ObjectiveProgress != null)
        {

            //npcObjective.currentProgress = npcObjective.goal; 
            ObjectiveManager.Instance.UpdateObjectiveProgress(ObjectiveProgress, 1);

            Debug.Log($"Objective '{ObjectiveProgress.objectiveName}' updated or completed.");
            ObjectiveProgress = null;
        }

        if (ObjectiveStart != null)
        {

            //npcObjective.currentProgress = npcObjective.goal; 
            ObjectiveManager.Instance.AddObjective(ObjectiveStart, transform);

            Debug.Log($"Objective '{ObjectiveStart.objectiveName}' started");
        }

        Debug.Log("Interacted with: " + gameObject.name);
        interactable = false;
    }
}