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;
|
||||
}
|
||||
}
|
||||
|
||||
18
Assets/Scripts/Table.cs
Normal file
18
Assets/Scripts/Table.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Table : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Table.cs.meta
Normal file
11
Assets/Scripts/Table.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ff11aa56b668504fa25b3bbeafe65f8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user