public void storeInInstance(nodeE val, Dictionary <dynamic, dynamic> dict) { if (val == nodeE.active) { active = dict[val]; } if (val == nodeE.name) { name = dict[val]; } if (val == nodeE.position) { body.pos = dict[val]; } if (val == nodeE.velocity) { body.velocity = dict[val]; } if (val == nodeE.radius) { body.radius = dict[val]; } if (val == nodeE.mass) { body.mass = dict[val]; } if (val == nodeE.texture) { body.texture = dict[val]; } if (val == nodeE.color) { body.color = dict[val]; } }
public Node(Room room, Dictionary <dynamic, dynamic> userProps, ShapeType shapetype = ShapeType.Circle) : this(room, shapetype) { if (userProps != null) { // add the userProps to the props foreach (dynamic p in userProps.Keys) { // if the key is a Type, we need to add the component to comps dict if (p is Type) { Type c = (Type)p; fetchComponent(c, userProps[c]); } // if the key is a nodeE, we need to update the instance variable value else if (p is nodeE) { nodeE nn = (nodeE)p; storeInInstance(nn, userProps); } } } SortComponentLists(); }