using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ClearCounterScript : MonoBehaviour
{
[SerializeField] private KitchenObjectSO kitchenObjectSO;
[SerializeField] private Transform counterTopPoint;
[SerializeField] private ClearCounterScript secondCounter;
[SerializeField] private bool testing;
private KitchenObject kObject;
public void Interact()
{
//Debug.Log("Interact!");
/*
* If there isn't a Kitchen Object in the scene;
* create one and only one
*
* The selected counter knows there's currently an object on it
* and the kitchen object itself knows where it currently is spawned
*
* The point where the kitchen object spawns on the counter
* is placed on the counter visual in the prefab
*/
if (kObject == null)
{
Transform kitchenObjectTransform = Instantiate(kitchenObjectSO.prefab, counterTopPoint);
kObject = kitchenObjectTransform.GetComponent<KitchenObject>();
/*
* Send this object in scene
* that this script is attached
* to as an argument
*
* 'this' keyword refers to the object
* the script is attached to in Scene
*/
kObject.SetClearCounter(this);
}
else
{
//kObject.SetClearCounter(player);
Debug.Log(kObject.GetClearCounter());
}
//Debug.Log(kitchenObjectTransform.GetComponent<KitchenObject>().GetKitchenObjectSO().objectName);
}