44 lines
929 B
C#
44 lines
929 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;
|
|
new public Transform transform;
|
|
public List <GameObject> IngredientIn;
|
|
public int NutritionalValue;
|
|
bool isMoving = false;
|
|
//public GameObject table;
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (isMoving)
|
|
{
|
|
Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
|
transform.position = new Vector3 (mousePosition.x, mousePosition.y, transform.position.z);
|
|
//Debug.Log(table.Bounds.Contains(mousePosition));
|
|
}
|
|
|
|
|
|
}
|
|
|
|
void OnMouseUp()
|
|
{
|
|
if (isMoving)
|
|
|
|
|
|
|
|
isMoving = false;
|
|
else
|
|
isMoving = true;
|
|
}
|
|
}
|