//------------------------------------------------------------------------- /// <summary> /// Load a Drawable XML file. /// </summary> /// <param name="name">Name of XML Drawable file</param> /// <returns>Loaded Drawable</returns> public Drawable loadDrawable(String name) { // Verify this Drawable has not already been loaded if (_objects.ContainsKey(name)) { return(_objects[name] as Drawable); } #if DEBUG Console.WriteLine("Loading Drawable: " + name); #endif // Load DrawableData DrawableData data = _contentMgr.Load <DrawableData>(DIR_DRAWABLES + name); // Load new Drawable Drawable drawable = new Drawable( name, loadTexture(data.TextureName), data.Origin); // Add to ContentManager addContentObject(drawable); return(drawable); }
public DrawableData GetSaveData() { var newData = new DrawableData() { GridCellPositions = new HashSet <SerializableVector2>(), PositionOnGrid = new SerializableVector2(PositionOnGrid.x, PositionOnGrid.y), Rotation = Rotation, Type = Type }; foreach (var gridCellPos in _gridCellPositions) { newData.GridCellPositions.Add(new SerializableVector2(gridCellPos.x, gridCellPos.y)); } return(newData); }