public void Add(object obj) { if (NonCollidables == null) { NonCollidables = new List <Sprite>(); } NonCollidables.Add((Sprite)obj); }
private void LoadNonCollidables() { foreach (ObjectsNode node in nonCollidableList) { Type t = Type.GetType(node.ObjectType); Vector2 position; position.X = node.Position.X; position.Y = node.Position.Y; var obj = Activator.CreateInstance(t, position); NonCollidables.Add((IObject)obj); } }
private void LoadNonCollidables() { nonCollidableList = XMLUtility.XMLReader <ObjectsNode>(StringConsts.NoncollidablesFile); foreach (ObjectsNode node in nonCollidableList) { Type t = Type.GetType(node.ObjectType); Vector2 position; position.X = node.Position.X; position.Y = node.Position.Y; var obj = Activator.CreateInstance(t, position); NonCollidables.Add((IObject)obj); } }