Moving Chimken
This commit is contained in:
@@ -5,8 +5,10 @@ using UnityEngine;
|
||||
public class Ingredient : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
//Vector3 mousePosition = Input.mousePosition;
|
||||
public Vector3 transform;
|
||||
Vector3 mousePosition;
|
||||
public Transform transform;
|
||||
bool isMoving = false;
|
||||
//public GameObject table;
|
||||
void Start()
|
||||
{
|
||||
|
||||
@@ -15,6 +17,24 @@ public class Ingredient : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//transform.position = Input
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user