void SetupVars() { var names = Util.Empty <string>(); if (dm.states.Count > 0) { var prev = dm.states.Last(); names = prev.vars.Map(v => v.realName); } names = names.Concat(state.Variables).Distinct(); var curVars = state.Variables.ToDictionary(x => x); foreach (var v in names) { if (dm.GetUserVariableName(v) != null) { var val = state.TryGet(v); var vn = new VariableNode(this, v, val); vn.updatedHere = dm.states.Count > 0 && curVars.ContainsKey(v); if (curVars.ContainsKey(v)) { dm.RegisterLocalValue(vn.Name, val); } vars.Add(vn); } } dm.Flush(Nodes); }