/// <summary>
    /// Called when a node is clicked with the pointer. Depending on the type passed it determins
    /// if it should store the node clicked or call a function to create the correct building type
    /// Returns true if the points should be deselected
    /// </summary>
    public bool setPoint(Vector3 point, buildingObjects type)
    {
        if (type == buildingObjects.Frame)
        {
            if (framePoints.Count == 1)
            {
                if (point != framePoints[0])
                {
                    createFrame(framePoints[0], point);
                    framePoints.Clear();
                    tempLineRenderer.enabled = false;
                    return(true);
                }
                else
                {
                    framePoints.Clear();
                    tempLineRenderer.enabled = false;
                    return(true);
                }
            }
            else
            {
                framePoints.Add(point);

                tempLineRenderer.enabled = true;
                tempLineRenderer.SetPosition(0, point);
                tempLineRenderer.SetPosition(1, point);
                return(false);
            }
        }
        else if (type == buildingObjects.Area)
        {
            if (framePoints[0] == point)
            {
                createArea(areaPoints);
                areaPoints.Clear();
            }
            else
            {
                areaPoints.Add(point);
            }
        }
        return(false);
    }
Пример #2
0
 void drawFrame(Vector3 p1, Vector3 p2, buildingObjects obj)
 {
     myConstructorController.setPoint(p1, obj);
     myConstructorController.setPoint(p2, obj);
 }