43 lines
1 KiB
C#
43 lines
1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class KitchenObject : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField] private KitchenObjectSO kitchenObjectSO;
|
|
|
|
private IKitchenObjectParent kitchenObjectParent;
|
|
|
|
public KitchenObjectSO GetKitchenObjectSO()
|
|
{
|
|
return kitchenObjectSO;
|
|
}
|
|
|
|
public void SetKitchenObjectParent(IKitchenObjectParent kitchenObjectParent)
|
|
{
|
|
if (this.kitchenObjectParent != null)
|
|
{
|
|
this.kitchenObjectParent.ClearKitchenObject();
|
|
}
|
|
|
|
this.kitchenObjectParent = kitchenObjectParent;
|
|
|
|
if (kitchenObjectParent.HasKitchenObject())
|
|
{
|
|
Debug.LogError("IKitchenObjectParent already has KitchenObject!");
|
|
}
|
|
|
|
kitchenObjectParent.SetKitchenObject(this);
|
|
|
|
transform.parent = kitchenObjectParent.GetKitchenObjectFollowTransform();
|
|
transform.localPosition = Vector3.zero;
|
|
}
|
|
|
|
public IKitchenObjectParent GetKitchenObjectParent()
|
|
{
|
|
return kitchenObjectParent;
|
|
}
|
|
|
|
|
|
}
|