Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        public static void RotateLine(LineArray horiz, LineArray vertical, int nodeX, int nodeY, 
		                              GameLine.LineDirection dirFrom, GameLine.LineDirection dirTo)
        {
            if (dirFrom == dirTo)
                return;

            GameLine line;
            if (dirFrom == GameLine.LineDirection.Up)
                line = vertical.RemoveLine(nodeX, nodeY);
            else if (dirFrom == GameLine.LineDirection.Left)
                line = horiz.RemoveLine(nodeX - 1, nodeY);
            else if (dirFrom == GameLine.LineDirection.Right)
                line = horiz.RemoveLine(nodeX, nodeY);
            else
                line = vertical.RemoveLine(nodeX, nodeY - 1);

            if (dirTo == GameLine.LineDirection.Up)
                vertical.SetLine(nodeX, nodeY, line);
            else if (dirTo == GameLine.LineDirection.Up)
                vertical.SetLine(nodeX, nodeY - 1, line);
            else if (dirTo == GameLine.LineDirection.Right)
                horiz.SetLine(nodeX, nodeY, line);
            else
                horiz.SetLine(nodeX - 1, nodeY, line);
        }
Esempio n. 2
0
        public GridData(int size, GameObject gameObject)
        {
            if (Current == null)
                Current = this;
            else
                throw new InvalidOperationException("Cannot have multiple main grids!");

            this.Size = size;
            nodeArray = new Node[Size,Size];
            this.gameObject = gameObject;

            horLines = new LineArray(size, size-1);
            vertLines = new LineArray(size-1, size);
        }