コード例 #1
0
    private void PointClicked(PointController clickedPoint)
    {
        if (clickedPoint.Order == lasClickedPointOrder + 1)
        {
            clickedPoint.StartClickAnimation();
            lasClickedPointOrder = clickedPoint.Order;

            // If not first point draws a line
            if (lasClickedPointOrder != 1)
            {
                var lastPoint = createdPoints[lasClickedPointOrder - 2];
                DrawRope(lastPoint.transform, clickedPoint.transform);
            }

            // If last point connects to first
            if (lasClickedPointOrder == createdPoints.Count)
            {
                var firstPoint = createdPoints.First(p => p.Order == 1);
                DrawRope(clickedPoint.transform, firstPoint.transform);

                levelFinished = true;
            }
        }
    }