コード例 #1
0
ファイル: Graphics.cs プロジェクト: 1sequins/LineGame
        /// <summary>
        /// Adds a line.
        /// </summary>
        /// <param name="pkt1">Point that the line is attached to.</param>
        /// <param name="pkt2">Other point that the line is attached to.</param>
        public void AddLine(Pkt pkt1, Pkt pkt2)
        {
            // DRAWING LINES USING LINE RENDERER:
            GameObject line = new GameObject();

            line.name  = pkt1.ID + ";" + pkt2.ID;
            line.tag   = "Line";
            line.layer = LAYER_LINE;

            // ADDING/CONFIGURING THE RENDERER COMPONENT
            LineRenderer renderer = line.AddComponent <LineRenderer>();

            renderer.useWorldSpace    = true;
            renderer.sortingLayerName = "Line";
            renderer.material         = lineMaterial;

            renderer.startColor = colors.LineClear;
            renderer.endColor   = colors.LineClear;
            renderer.startWidth = 1.5f;
            renderer.endWidth   = 1.5f;

            Vector3[] pos = { pkt1.Position, pkt2.Position };
            line.transform.parent = pkt1.Circle.transform;
            renderer.SetPositions(pos);

            pkt1.AddLine(line);
            pkt2.AddLine(line);
        }
コード例 #2
0
ファイル: ClickManager.cs プロジェクト: 1sequins/LineGame
//----------------------------------------INPUT / INTERACTION METHODS----------------------------------\\
        private void OnInteractionStart(Vector2 inputPosition)
        {
            Pkt g = IdentifyClickedItem();

            if (g != null) // BRUKER TRYKKER NED KNAPP PÅ ET OBJEKT
            {
                g.Position    = inputPosition;
                heldWithMouse = true;
                held          = g;
            }
        }
コード例 #3
0
ファイル: Graphics.cs プロジェクト: 1sequins/LineGame
        /// <summary>
        /// Draws the circles at spesified positions one the board.
        /// The points are specified by the "points" array.
        /// </summary>
        /// <param name="points">Points in the plane.</param>
        public Pkt[] AddCircles(Vector2[] points, Vector2 initialPosition)
        {
            Pkt[] circles = new Pkt[points.Length];

            for (int i = 0; i < points.Length; i++)
            {
                circles[i] = AddCircle(i, points[i], initialPosition);
            }

            for (int i = 1; i <= points.Length; i++)
            {
                if (i == points.Length)
                {
                    AddLine(circles[i - 1], circles[0]);
                }
                else
                {
                    AddLine(circles[i - 1], circles[i]);
                }
            }

            return(circles);
        }
コード例 #4
0
ファイル: ClickManager.cs プロジェクト: 1sequins/LineGame
//----------------------------------------METHODS FOR LINEHANDELING----------------------\\
        /// <summary>
        /// Clears the level.
        /// </summary>
        private void ClearLevel()
        {
            heldWithMouse = false;
            levelIsWon    = false;
            held          = null;
        }
コード例 #5
0
ファイル: ClickManager.cs プロジェクト: 1sequins/LineGame
 private void OnInteractionStop()
 {
     heldWithMouse = false;
     held          = null;
 }