public Component Walk(int depth) { _walks = new Dictionary <Behavior, Walk <Type> >(); foreach (Behavior b in _behaviors) { Action[] actions = b.GetCurrentState()?.GetActions().ToArray(); if (actions?.Length > 0) { Action a = actions[0]; if (a.GetActionType() != null) { Walk <Type> walkThe = new Walk <Type>(a.GetActionType(), depth); walkThe.StartWalking(); _walks.Add(b, walkThe); } } } return(this); }