Beispiel #1
0
    public bool SelectVertex(int X, int Y)
    {
        sVertex v = listVertex.Find(V => V.IsVertex(X, Y));

        if (v == null)
        {
            return(false);
        }
        if (workVertex != null)
        {
            workVertex.SetInactive();
        }
        v.SetActive();
        workVertex = v;
        sHelper.GetInstance().GuideLines(v.GameObject().transform.position.x, v.GameObject().transform.position.y);
        selected = true;
        return(true);
    }
Beispiel #2
0
    public bool RemoveVertex(sVertex vertex)
    {
        if (vertex == null)
        {
            return(false);
        }
        List <sLine> toRemove = listLine.FindAll(l => l.IsEndPoint(vertex));

        foreach (sLine l in toRemove)
        {
            RemoveLine(l);
        }
        listVertex.Remove(vertex);
        Destroy(vertex.GameObject());
        // Se último vértice foi excluído, auto-destrói (retorna true)
        if (listVertex.Count == 0)
        {
            return(true);
        }
        return(false);
    }