void MouseCheck() // 마우스 좌클릭 체크.
{
Event currentEvent = Event.current;
switch (currentEvent.rawType)
{
case EventType.MouseDown:
if (currentEvent.button == 0 && mouseLeftDown == false)
{
mouseLeftDown = true;
GUIUtility.hotControl = 0;
SaveUndo();
currentEvent.Use();
if (isEditing)
{
if (minMidVertPos != Vector3.zero && AbleEditting(minMidVertPos))
{
int frontVertex = 0, backVertex = 0;
myMeshCreator.FindLinkedVertex(minMidVertPos, out frontVertex, out backVertex);
myMeshCreator.InsertTriangle(frontVertex, backVertex, MouseInfo.Position - myMeshCreator.transform.position);
minMidVertPos = Vector3.zero;
editingVert = myMeshCreator.GetMesh().vertices.Length - 1;
}
else if (AbleEditting(minVert))
{
editingVert = minVert;
}
else
{
editingVert = -1;
}
}
else if (isRemoving && AbleEditting(minVert))
{
if (minMidVertPos == Vector3.zero && myMeshCreator.GetRemoveAble()[minVert] == true)
{
myMeshCreator.RemoveVertex(minVert);
myMeshCreator.CheckRemoveAbleAll();
}
}
}
break;
case EventType.MouseUp:
if (currentEvent.button == 0)
{
mouseLeftDown = false;
// GUIUtility.hotControl = GUIUtility.GetControlID(FocusType.Passive);
GUIUtility.hotControl = 0; // 왠진 모르겟지만 0도 되서 그냥 0으로.
currentEvent.Use();
}
break;
}
}