Beispiel #1
0
        public bool RemoveFromGrid(Grid grid)
        {
            string Key = GetKey();

            if (!grid.Nodes.ContainsKey(Key))
            {
                return(false);
            }

            foreach (string SideKey in Sides.Keys)
            {
                if (!grid.Nodes.TryGetValue(SideKey, out Node Side))
                {
                    continue;
                }

                Side.DisconnectFrom(this);
            }

            Sides.Clear();

            grid.Nodes.Remove(Key);
            grid.Locked.Remove(Key);
            grid.Unused.Remove(this);

            return(true);
        }