using UnityEngine; public class Player : MonoBehaviour { public Transform spawnPoint; [SerializeField] private int food; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { } // Update is called once per frame void Update() { } public void OnInteract() { if (UseFood()) { } } public void FindFood() { food++; } public bool UseFood() { bool hasEaten = true; if (food > 0) { food--; } else { Debug.Log("i'm starving"); hasEaten = false; } return hasEaten; } public void Kill() { this.GetComponent().linearVelocity = Vector2.zero; this.gameObject.transform.position = spawnPoint.position; Debug.Log("Player died"); } }