Files
let-him-cook/Assets/Scripts/Ingredient.cs
2024-04-27 14:31:39 +02:00

44 lines
928 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ingredient : MonoBehaviour
{
// Start is called before the first frame update
// L
Vector3 mousePosition;
public List <GameObject> IngredientIn;
public int NutritionalValue;
bool isMoving = false;
//public GameObject table;
Vector3 DefaultPosition;
void Start()
{
DefaultPosition = transform.position;
}
// Update is called once per frame
void Update()
{
if (isMoving)
{
Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.position = mousePosition;
}
}
void OnMouseUp()
{
if (isMoving)
isMoving = false;
else
isMoving = true;
}
public void ResetPosition()
{
transform.position = DefaultPosition;
}
}