Allow proper moving of kitchen objects and player pickup

This commit is contained in:
BuyMyMojo 2023-02-28 22:59:20 +11:00
parent 1729ddf5c6
commit 234e00cb9b
10 changed files with 213 additions and 11 deletions

View file

@ -1,8 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEditorInternal;
using UnityEngine;
public class Player : MonoBehaviour
public class Player : MonoBehaviour, IKitchenObjectParent
{
public static Player Instance { get; private set; }
@ -16,10 +18,12 @@ public class Player : MonoBehaviour
[SerializeField] private float moveSpeed = 7f;
[SerializeField] private GameInput gameInput;
[SerializeField] private LayerMask countersLayerMask;
[SerializeField] private Transform kitchenObjectHoldPoint;
private bool isWalking;
private Vector3 lastInteractDir;
private ClearCounter selectedCounter;
private KitchenObject kitchenObject;
private void Start()
{
@ -30,7 +34,7 @@ public class Player : MonoBehaviour
{
if (selectedCounter != null)
{
selectedCounter.Interact();
selectedCounter.Interact(this);
}
}
@ -155,4 +159,28 @@ public class Player : MonoBehaviour
});
}
public Transform GetKitchenObjectFollowTransform()
{
return kitchenObjectHoldPoint;
}
public void SetKitchenObject(KitchenObject kitchenObject)
{
this.kitchenObject = kitchenObject;
}
public KitchenObject GetKitchenObject()
{
return kitchenObject;
}
public void ClearKitchenObject()
{
kitchenObject = null;
}
public bool HasKitchenObject()
{
return kitchenObject != null;
}
}