Beispiel #1
0
    private void DeleteStretchesButtons()
    {
        Handles.color = Color.red;
        for (int i = 0; i < creator.stretches.Count; i++)
        {
            Stretch    st  = creator.stretches.ElementAt(i).Value;
            Vector3    pos = st.MidPoint;
            Quaternion rot = Quaternion.LookRotation((Camera.current.transform.position - pos).normalized, Vector3.up);
            if (Handles.Button(pos, rot, 1, 1, Handles.SphereHandleCap))
            {
                Vector2Int key = creator.stretches.ElementAt(i).Key;
                creator.PrepareDelete(key);
                Undo.RegisterCompleteObjectUndo(creator, "Deleted Stretch");
                creator.stretches.Remove(key);

                GetNode(key.x).nStretches--;
                GetNode(key.y).nStretches--;
            }
        }
    }