private void forEachInternal(Dictionary <ulong, bool> explored, FighterHandler func)
        {
            if (explored.ContainsKey(ID))
            {
                return;
            }

            // Mark this node as explored
            explored.Add(ID, true);

            // Explore children
            foreach (Fighter c in children)
            {
                c.forEachInternal(explored, func);
            }

            // Apply callback
            func(this);
        }
        private void forEachInternal(Dictionary<ulong, bool> explored, FighterHandler func)
        {
            if (explored.ContainsKey(ID)) {
                return;
            }

            // Mark this node as explored
            explored.Add(ID, true);

            // Explore children
            foreach (Fighter c in children) {
                c.forEachInternal(explored, func);
            }

            // Apply callback
            func(this);
        }
 public void ForEach(FighterHandler func)
 {
     Dictionary<ulong, bool> explored = new Dictionary<ulong, bool>();
     forEachInternal(explored, func);
 }
        public void ForEach(FighterHandler func)
        {
            Dictionary <ulong, bool> explored = new Dictionary <ulong, bool>();

            forEachInternal(explored, func);
        }