23 lines
553 B
C#
23 lines
553 B
C#
using UnityEngine;
|
|
|
|
public class Point : MonoBehaviour
|
|
{
|
|
public int id;
|
|
public UntangleGameManager manager;
|
|
private Vector3 offset;
|
|
|
|
void OnMouseDown()
|
|
{
|
|
offset = transform.position - Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
|
}
|
|
|
|
void OnMouseDrag()
|
|
{
|
|
Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition) + offset;
|
|
pos.z = 0;
|
|
transform.position = pos;
|
|
manager.CheckIfSolved();
|
|
foreach (var c in manager.connections)
|
|
c.UpdateLine();
|
|
}
|
|
} |