Example #1
0
        /// <summary>
        /// Removes the node at the specified position from the grid.
        /// A node will only be removed if there exists a node at
        /// that position.
        /// </summary>
        /// <returns>True if the operation succeeded</returns>
        public bool RemoveNode(Point pos)
        {
            // Don't continue if the node doesn't exist
            var node = NodeAt(pos);

            if (node == null)
            {
                return(false);
            }

            // Remove the node itself
            _nodeMap.Remove(node.Position);
            Nodes.Remove(node);

            // Destroy fields
            _fieldBuilder.DestroyFields(node);

            return(true);
        }