Example #1
0
        /// <summary>
        /// Adds the specified node to the grid. A node will only be added
        /// if there does not exist a node in the grid at the same position.
        /// </summary>
        /// <returns>True if the operation succeeded</returns>
        public bool AddNode(Node node)
        {
            // Don't add the node if another one already exists
            if (HasNodeAt(node.Position))
            {
                return(false);
            }

            // Add the node based on its position
            _nodeMap.Add(node.Position, node);
            Nodes.Add(node);

            // Build fields
            _fieldBuilder.BuildFields(node, _nodeMap);

            return(true);
        }