/// <summary> /// Removes the Floor to ListObjects and adds all relevant cells to the grid /// </summary> /// <param name="f">Floor to add</param> /// <param name="dontRemove">True means the item added will not be added to the list of Levelobjects</param> /// <returns>Success</returns> internal bool Remove(Floor f, out List <Tile> Tiles, bool dontRemove = false) { List <Tile> tiles = new List <Tile>(); //we're going to be getting them a lot otherwise Index2D start = new Index2D(Math.Min(f.StartCell.X, f.EndCell.X), Math.Min(f.StartCell.Y, f.EndCell.Y)); Index2D end = new Index2D(Math.Max(f.StartCell.X, f.EndCell.X), Math.Max(f.StartCell.Y, f.EndCell.Y)); if (dontRemove || Remove(f)) { //add tiles to the list //place floor for (int y = start.Y; y <= end.Y; y++) { for (int x = start.X; x <= end.X; x++) { //Remove Bottom Tile t = new Tile() { Type = f.Type, FloorType = f.FloorType, Theme = f.Theme, Traversable = f.Traversable, Orientation = Orientations.Down, GridCell = new Index2D(x, y) }; tiles.Add(t); Remove(t, t.GridCell.X, t.GridCell.Y); } } } Tiles = tiles; return(true); }
public BorderWalls(Index2D start, Index2D end, TileTypes t, Element theme, bool move = true) { StartCell = start; EndCell = end; Type = t; Theme = theme; Traversable = move; }
public Room(Index2D start, Index2D end, Element theme, TileTypes f = TileTypes.Floor, bool move = true) { StartCell = start; EndCell = end; FloorType = f; Theme = theme; Traversable = move; }
public Wall(Index2D start, Index2D end, TileTypes t, Element theme, bool move = false) { StartCell = start; EndCell = end; Type = t; Theme = theme; Traversable = move; }
public Wall(Index2D start, Index2D end, Orientations or, TileTypes t, Element theme = Element.DEFAULT, bool move = false) { StartCell = start; EndCell = end; Type = t; Theme = theme; Traversable = move; Orientation = or; }
public Floor(Index2D start, Index2D end, TileTypes t, Element theme, bool move = true, TileTypes f = TileTypes.Floor) { StartCell = start; EndCell = end; Type = t; Theme = theme; Traversable = move; FloorType = f; }
public Floor(Room r) { Index2D start = new Index2D(Math.Min(r.StartCell.X, r.EndCell.X), Math.Min(r.StartCell.Y, r.EndCell.Y)); Index2D end = new Index2D(Math.Max(r.StartCell.X, r.EndCell.X), Math.Max(r.StartCell.Y, r.EndCell.Y)); StartCell = new Index2D(start.X + 1, start.Y + 1); EndCell = new Index2D(end.X - 1, end.Y - 1); Type = r.Type; Theme = r.Theme; Traversable = r.FloorType == TileTypes.Floor ? true : false; FloorType = r.FloorType; Type = r.FloorType == TileTypes.Floor ? TileTypes.Floor : r.FloorType == TileTypes.Lava ? TileTypes.Lava : TileTypes.Water; }
public static Room Parse(XElement elem) { #if DEBUG1 try { #endif if (elem.Attribute("FloorType") != null && elem.Attribute("Collision") != null) { return(new Room( Index2D.Parse(elem.Attribute("StartCell").Value), Index2D.Parse(elem.Attribute("EndCell").Value), //(TileTypes)Enum.Parse(typeof(TileTypes), elem.Attribute("Type").Value), (Element)Enum.Parse(typeof(Element), elem.Attribute("Theme").Value), (TileTypes)Enum.Parse(typeof(TileTypes), elem.Attribute("FloorType").Value), bool.Parse(elem.Attribute("Collision").Value) )); } else if (elem.Attribute("FloorType") != null) { return(new Room( Index2D.Parse(elem.Attribute("StartCell").Value), Index2D.Parse(elem.Attribute("EndCell").Value), //(TileTypes)Enum.Parse(typeof(TileTypes), elem.Attribute("Type").Value), (Element)Enum.Parse(typeof(Element), elem.Attribute("Theme").Value), (TileTypes)Enum.Parse(typeof(TileTypes), elem.Attribute("FloorType").Value) )); } else { return(new Room( Index2D.Parse(elem.Attribute("StartCell").Value), Index2D.Parse(elem.Attribute("EndCell").Value), //(TileTypes)Enum.Parse(typeof(TileTypes), elem.Attribute("Type").Value), (Element)Enum.Parse(typeof(Element), elem.Attribute("Theme").Value) )); } #if DEBUG1 } catch (Exception e) { Console.WriteLine(e.GetBaseException().Message); return(null); } #endif }
public static Tile Parse(XElement elem) { #if DEBUG1 try { #endif Tile t = new Tile(); foreach (XAttribute attr in elem.Attributes()) { if (attr.Name == "Type") { t.Type = (TileTypes)Enum.Parse(typeof(TileTypes), attr.Value); } else if (attr.Name == "InstanceName") { t.InstanceName = attr.Value; } else if (attr.Name == "Collision") { t.Traversable = bool.Parse(attr.Value); } else if (attr.Name == "Theme") { t.Theme = (Element)Enum.Parse(typeof(Element), attr.Value); } else if (attr.Name == "Orientation") { t.Orientation = (Orientations)Enum.Parse(typeof(Orientations), attr.Value); } else if (attr.Name == "GridCell") { t.GridCell = Index2D.Parse(attr.Value); } } return(t); #if DEBUG1 } catch (Exception e) { Console.WriteLine(e.GetBaseException().Message); return(null); } #endif }
public static BorderWalls Parse(XElement elem) { #if DEBUG1 try { #endif return(new BorderWalls( Index2D.Parse(elem.Attribute("StartCell").Value), Index2D.Parse(elem.Attribute("EndCell").Value), (TileTypes)Enum.Parse(typeof(TileTypes), elem.Attribute("Type").Value), (Element)Enum.Parse(typeof(Element), elem.Attribute("Theme").Value), bool.Parse(elem.Attribute("Collision").Value) )); #if DEBUG1 } catch (Exception e) { Console.WriteLine(e.GetBaseException().Message); return(null); } #endif }
internal bool TryGetValue(int x, int y, out Tile value) { if (y >= 0 && y < mTiles.Count && x >= 0 && x < mTiles[0].Count) { if (cache_key.X == x && cache_key.Y == y) { value = cache_value; return(true); } if (mTiles[y][x] != null) { value = mTiles[y][x]; cache_key = new Index2D(x, y); cache_value = value; return(true); } } value = new Tile() { GridCell = new Index2D(x, y) }; return(false); }
/// <summary> /// Obtains a list of tiles within the 2D range from top left to bottom right /// </summary> /// <param name="startCell">Top Left of the range</param> /// <param name="endCell">Bottom Right of the range</param> /// <returns>Lsit of all Tiles within the range</returns> internal List <Tile> GetCurrentState(Index2D startCell, Index2D endCell) { List <Tile> tiles = new List <Tile>(); for (int row = startCell.Y, rowEnd = endCell.Y, col = Math.Min(startCell.X, endCell.X), colEnd = Math.Max(startCell.X, endCell.X); row <= rowEnd; row++) { //we want to make sure that we put in empty items //on our grid if our list is empty or the first element has GridCell == null (we can assume the whole set will) if (mTiles.Count > 0 && mTiles.Count > row && //make sure the row exists mTiles[row].Count > col && //make sure the col exists mTiles[row].Count > colEnd //make sure the colEnd exists ) { for (col = Math.Min(startCell.X, endCell.X); col <= colEnd; col++) { Tile t = mTiles[row][col]; tiles.Add(t.GridCell != null ? t : new Tile() { GridCell = new Index2D(col, row) }); } } else { for (col = Math.Min(startCell.X, endCell.X); col <= colEnd; col++) { tiles.Add(new Tile() { GridCell = new Index2D(col, row) }); } } } return(tiles); }
public Room(Index2D start) { StartCell = start; }
/// <summary> /// creates all the rooms, tiles, etc that would be needed to generate the level /// </summary> /// <returns></returns> public List <LevelObject> GenerateSaveObjects(Element theme = Element.DEFAULT) { List <LevelObject> objs = new List <LevelObject>(); TileList copy = Duplicate(); //remove from copy all the tiles that match our current objects foreach (var lo in LevelParts) { if (lo is LevelPart) { List <Tile> removed = copy.Add(lo as LevelPart); objs.Add(lo); //foreach (Tile tile in removed) //{ // Index2D cell = tile.GridCell; // if (mTiles[cell.Y][cell.X] == tile) // { // copy.Add(tile); // } //} } else if (lo is Tile) { Tile tile = lo as Tile; if (tile.Theme == Element.DEFAULT) { tile.Theme = theme; } objs.Add(lo); Index2D cell = tile.GridCell; if (mTiles[cell.Y][cell.X] == tile) { copy.Add(tile); } } } int ycount = mTiles.Count; if (ycount > 0) { int xcount = mTiles[0].Count; for (int y = 0; y < ycount; y++) { for (int x = 0; x < xcount; x++) { Tile tileFromCopy = copy[y][x]; Tile tileFromUs = this[y][x]; //this means it's a tile we care about if (tileFromCopy != tileFromUs) { if (tileFromUs.Theme == Element.DEFAULT) { tileFromUs.Theme = theme; } if (tileFromUs.GridCell == null) { tileFromUs.GridCell = new Index2D(x, y); } objs.Add(tileFromUs); } } } } return(objs); }
public BorderWalls(Index2D start) { StartCell = start; }
public Floor(Index2D start, Index2D end, TileTypes t, Element theme, bool move = true, FloorTypes f = FloorTypes.Themed) { StartCell = start; EndCell = end; Type = t; Theme = theme; Traversable = move; FloorType = f; }
/// <summary> /// Determines what an object is and adds it to the level /// </summary> /// <param name="obj">Object we want to split and add</param> internal List <Tile> Remove(LevelPart obj, bool dontRemove = false) { List <Tile> tiles = new List <Tile>(); //deterime what it is if (obj is Room) { Room r = obj as Room; if (Remove(r)) { //we're going to be getting them a lot otherwise Index2D start = new Index2D(Math.Min(r.StartCell.X, r.EndCell.X), Math.Min(r.StartCell.Y, r.EndCell.Y)); Index2D end = new Index2D(Math.Max(r.StartCell.X, r.EndCell.X), Math.Max(r.StartCell.Y, r.EndCell.Y)); List <Tile> t; Remove(new BorderWalls(r), out t, true); //for some reson foreach doesn't work here for (int i = 0; i < t.Count; i++) { tiles.Add(t[i]); } t = new List <Tile>(); Remove(new Floor(r), out t, true); //for some reson foreach doesn't work here for (int i = 0; i < t.Count; i++) { tiles.Add(t[i]); } } } else if (obj is BorderWalls) { List <Tile> t; Remove(obj as BorderWalls, out t, dontRemove); //for some reson foreach doesn't work here for (int i = 0; i < t.Count; i++) { tiles.Add(t[i]); } } else if (obj is Wall) { List <Tile> t; Remove(obj as Wall, out t, dontRemove); //for some reson foreach doesn't work here for (int i = 0; i < t.Count; i++) { tiles.Add(t[i]); } } else if (obj is Floor) { List <Tile> t; Remove(obj as Floor, out t, dontRemove); //for some reson foreach doesn't work here for (int i = 0; i < t.Count; i++) { tiles.Add(t[i]); } } return(tiles); }
public Wall(Index2D start) { StartCell = start; }
/// <summary> /// Removes the Walls to ListObjects and adds all relevant cells to the grid /// </summary> /// <param name="w">Walls to add</param> /// <param name="Tiles">Listof tiles generated by the borderawlls</param> /// <param name="dontRemove">True means the item added will not be added to the list of Levelobjects</param> /// <returns>Success</returns> private void Remove(BorderWalls w, out List <Tile> Tiles, bool dontRemove = false) { //we're going to be getting them a lot otherwise Index2D start = new Index2D(Math.Min(w.StartCell.X, w.EndCell.X), Math.Min(w.StartCell.Y, w.EndCell.Y)); Index2D end = new Index2D(Math.Max(w.StartCell.X, w.EndCell.X), Math.Max(w.StartCell.Y, w.EndCell.Y)); List <Tile> tiles = new List <Tile>(); if (dontRemove || Remove(w)) { List <Tile> ts; //place Left wall Remove(new Wall(new Index2D(start.X, start.Y + 1), new Index2D(start.X, end.Y - 1), Orientations.Left, TileTypes.SideWall, w.Theme), out ts, true); //for some reson foreach doesn't work here for (int i = 0; i < ts.Count; i++) { tiles.Add(ts[i]); } //place right wall Remove(new Wall(new Index2D(end.X, start.Y + 1), new Index2D(end.X, end.Y - 1), Orientations.Right, TileTypes.SideWall, w.Theme), out ts, true); //for some reson foreach doesn't work here for (int i = 0; i < ts.Count; i++) { tiles.Add(ts[i]); } //place Top wall Remove(new Wall(new Index2D(start.X + 1, start.Y), new Index2D(end.X - 1, start.Y), Orientations.Down, TileTypes.Wall, w.Theme), out ts, true); //for some reson foreach doesn't work here for (int i = 0; i < ts.Count; i++) { tiles.Add(ts[i]); } //place Top wall Remove(new Wall(new Index2D(start.X + 1, end.Y), new Index2D(end.X - 1, end.Y), Orientations.Down, TileTypes.Bottom, w.Theme), out ts, true); //for some reson foreach doesn't work here for (int i = 0; i < ts.Count; i++) { tiles.Add(ts[i]); } //place corners //TL Tile t = new Tile() { Type = TileTypes.Corner, Theme = w.Theme, Traversable = false, Orientation = Orientations.Left, GridCell = start, }; tiles.Add(t); Remove(t, t.GridCell.X, t.GridCell.Y); //TR t = new Tile() { Type = TileTypes.Corner, Theme = w.Theme, Traversable = false, Orientation = Orientations.Down, GridCell = new Index2D(end.X, start.Y) }; tiles.Add(t); Remove(t, t.GridCell.X, t.GridCell.Y); //BL t = new Tile() { Type = TileTypes.Corner, Theme = w.Theme, Traversable = false, Orientation = Orientations.Up_Left, GridCell = new Index2D(start.X, end.Y) }; tiles.Add(t); Remove(t, t.GridCell.X, t.GridCell.Y); //BR t = new Tile() { Type = TileTypes.Corner, Theme = w.Theme, Traversable = false, Orientation = Orientations.Up, GridCell = new Index2D(end.X, end.Y) }; tiles.Add(t); Remove(t, t.GridCell.X, t.GridCell.Y); } Tiles = tiles; }
void Level_MouseDown(object sender, MouseButtonEventArgs e) { //do some handling here for end of room that skips the rest if (SelectedTile != null && SelectedTile.IsSpecialObject) { if (e.MouseDevice.LeftButton == MouseButtonState.Pressed) { if (SelectedObject == null) { GridCell = GetCell(e.GetPosition(Level)); Index2D i = new Index2D(GridCell.X, GridCell.Y); // fill the pieces if (SelectedTile.Name == "Room") { SelectedObject = new Room(i) { FloorType = SelectedTile.FloorType, }; } else if (SelectedTile.Name == "Walls") { SelectedObject = new BorderWalls(i) { FloorType = SelectedTile.FloorType, }; } else if (SelectedTile.Name == "Wall") { SelectedObject = new Wall(i) { FloorType = SelectedTile.FloorType, }; } else if (SelectedTile.Name == "Floor") { SelectedObject = new Floor(i) { FloorType = SelectedTile.FloorType, }; } } else//here we complete things for the object { GridCell=GetCell(e.GetPosition(Level)); SelectedObject.EndCell = new Index2D(GridCell.X, GridCell.Y); //determine what it is List<Tile> tiles = ToListTile(TileMap.Add(SelectedObject)); foreach (Tile t in tiles) { Grid.SetColumn(t, t.GridCell.X); Grid.SetRow(t, t.GridCell.Y); This.mainWindow.Level.Children.Add(t); } SelectedObject = null; } } else if (e.MouseDevice.RightButton == MouseButtonState.Pressed) { } } else { if (e.MouseDevice.LeftButton == MouseButtonState.Pressed) { if (SelectedTile != null) { GridCell = GetCell(e.GetPosition(Level)); FirstClick = true; AddTile(GridCell); } } else if (e.MouseDevice.RightButton == MouseButtonState.Pressed) { if (ClearTile) { GridCell = GetCell(e.GetPosition(Level)); RemoveTile(GridCell); FirstClick = true; } CancelSelection = true; } } }
public Floor(Index2D start) { StartCell = start; }
/// <summary> /// Determines what an object is and adds it to the level /// </summary> /// <param name="obj">Object we want to split and add</param> internal List <Tile> Add(LevelPart obj, bool dontAdd = false) { List <Tile> tiles = new List <Tile>(); //deterime what it is if (obj is Room) { Room r = obj as Room; if (dontAdd || Add(r)) { //we're going to be getting them a lot otherwise Index2D start = new Index2D(Math.Min(r.StartCell.X, r.EndCell.X), Math.Min(r.StartCell.Y, r.EndCell.Y)); Index2D end = new Index2D(Math.Max(r.StartCell.X, r.EndCell.X), Math.Max(r.StartCell.Y, r.EndCell.Y)); List <Tile> t; Add(new BorderWalls(r), out t, true); //for some reson foreach doesn't work here for (int i = 0; i < t.Count; i++) { tiles.Add(t[i]); } t = new List <Tile>(); Add(new Floor(r), out t, true); //for some reson foreach doesn't work here for (int i = 0; i < t.Count; i++) { tiles.Add(t[i]); } } } else if (obj is BorderWalls) { List <Tile> t = new List <Tile>(); BorderWalls b = obj as BorderWalls; /// \todo Make this instead spit out a wall if (!(b.StartCell.X == b.EndCell.X || b.StartCell.Y == b.EndCell.Y)) { Add(b, out t, dontAdd); } //for some reson foreach doesn't work here for (int i = 0; i < t.Count; i++) { tiles.Add(t[i]); } } else if (obj is Wall) { List <Tile> t; Add(obj as Wall, out t, dontAdd); //for some reson foreach doesn't work here for (int i = 0; i < t.Count; i++) { tiles.Add(t[i]); } } else if (obj is Floor) { List <Tile> t; Add(obj as Floor, out t, dontAdd); //for some reson foreach doesn't work here for (int i = 0; i < t.Count; i++) { tiles.Add(t[i]); } } return(tiles); }
public Room(Index2D start, Index2D end, Element theme, FloorTypes f = FloorTypes.Themed, bool move = true) { StartCell = start; EndCell = end; FloorType = f; Theme = theme; Traversable = move; }
/// <summary> /// Removes the Wall to ListObjects and adds all relevant cells to the grid /// </summary> /// <param name="w">Wall to add</param> /// <param name="dontRemove">True means the item added will not be added to the list of Levelobjects</param> /// <returns>Success</returns> internal bool Remove(Wall w, out List <Tile> Tiles, bool dontRemove = false) { List <Tile> tiles = new List <Tile>(); //we're going to be getting them a lot otherwise Index2D start = new Index2D(Math.Min(w.StartCell.X, w.EndCell.X), Math.Min(w.StartCell.Y, w.EndCell.Y)); Index2D end = new Index2D(Math.Max(w.StartCell.X, w.EndCell.X), Math.Max(w.StartCell.Y, w.EndCell.Y)); Index2D diff = end - start; if (dontRemove || Remove(w)) { //add tiles to the list if (w.Type == TileTypes.SideWall || diff.MagX < diff.MagY) { //place on side //Rt wall if (w.Orientation == Orientations.Right || diff.X < 0) { for (int y = start.Y; y <= end.Y; y++) { //Remove Right Tile t = new Tile() { Type = TileTypes.SideWall, Theme = w.Theme, Traversable = false, Orientation = Orientations.Right, GridCell = new Index2D(end.X, y) }; tiles.Add(t); Remove(t, t.GridCell.X, t.GridCell.Y); } } //left wall else if (w.Orientation == Orientations.Left || diff.X > 0) { for (int y = start.Y; y <= end.Y; y++) { //Remove left Tile t = new Tile() { Type = TileTypes.SideWall, Theme = w.Theme, Traversable = false, Orientation = Orientations.Left, GridCell = new Index2D(start.X, y) }; tiles.Add(t); Remove(t, t.GridCell.X, t.GridCell.Y); } } } else if (w.Type == TileTypes.Wall || (diff.MagX > diff.MagY && w.Type == TileTypes.Wall)) { //Place top for (int x = start.X; x <= end.X; x++) { //Remove Top Tile t = new Tile() { Type = TileTypes.Wall, Theme = w.Theme, Traversable = false, Orientation = diff.Y >= 0 ? Orientations.Down : Orientations.Up, GridCell = new Index2D(x, start.Y) }; tiles.Add(t); Remove(t, t.GridCell.X, t.GridCell.Y); } } else if (w.Type == TileTypes.Bottom || (diff.MagX > diff.MagY && w.Type == TileTypes.Bottom)) { for (int x = start.X; x <= end.X; x++) { //Remove Bottom Tile t = new Tile() { Type = TileTypes.Wall, Theme = w.Theme, Traversable = false, Orientation = diff.Y < 0 ? Orientations.Down : Orientations.Up, GridCell = new Index2D(x, end.Y) }; tiles.Add(t); Remove(t, t.GridCell.X, t.GridCell.Y); } } } Tiles = tiles; return(true); }
internal void Load(XDocument doc) { TileMap = new TileList(doc); foreach (XElement elem in doc.Descendants("Enemy")) { string type = elem.Attribute("Type").Value; Type t = Type.GetType(type); var obj = Activator.CreateInstance(t, new object[] { elem.Attribute("Name").Value, Index2D.Parse(elem.Attribute("Pos").Value).Vector }); } foreach (XElement elem in doc.Descendants("Object")) { string type = elem.Attribute("Type").Value; Type t = Type.GetType(type); if (elem.Attribute("Orientation") != null) { var obj = Activator.CreateInstance(t, new object[] { elem.Attribute("Name").Value, Index2D.Parse(elem.Attribute("Pos").Value).Vector, (Orientations)Enum.Parse(typeof(Orientations), elem.Attribute("Orientation").Value) }); } else { var obj = Activator.CreateInstance(t, new object[] { elem.Attribute("Name").Value, Index2D.Parse(elem.Attribute("Pos").Value).Vector }); } } }
/// <summary> /// Loads the animations from a file. /// </summary> /// <param name="filename">Name of animfile</param> /// <param name="contentSubfolder">Folder where content is stored</param> private void LoadAnimation(string filename, string contentSubfolder) { filename = String.Format("Content/{0}/{1}", contentSubfolder, filename); if (!File.Exists(filename)) { throw new Exception(String.Format("Animation file {0} does not exist.", filename)); } XDocument doc = XDocument.Load(filename); foreach (var frame in doc.Descendants("Frame")) { SpriteFrame sf = new SpriteFrame(); string[] sp = frame.Attribute("TLPos").Value.Split(','); sf.StartPos = new Vector2(float.Parse(sp[0]), float.Parse(sp[1])); ///image string file = frame.Attribute("SpriteSheet").Value; sf.Image = This.Game.Content.Load <Texture2D>(String.Format("{0}/{1}", contentSubfolder, file)); /** sets frame delay */ sf.Pause = int.Parse(frame.Attribute("FrameDelay").Value); //Image's width and height sf.Width = int.Parse(frame.Attribute("Width").Value); sf.Height = int.Parse(frame.Attribute("Height").Value); /** Set the animation Peg*/ sf.AnimationPeg = Index2D.Parse(frame.Attribute("AnimationPeg").Value).Vector; //add the mirror offset if there is one if (frame.Attribute("MirrorOffset") != null) { sf.MirrorOffset = Index2D.Parse(frame.Attribute("MirrorOffset").Value).Vector; } foreach (var hotspot in frame.Descendants("HotSpot")) { sf.HotSpots.Add(Index2D.Parse(hotspot.Value).Vector); } int idCount = 0; foreach (var collision in frame.Descendants("Collision")) { if (collision.Attribute("Type").Value == "Circle") { string[] pt = collision.Attribute("Pos").Value.Split(','); sf.CollisionData.Add(new Collision_BoundingCircle( idCount++, new Vector2(float.Parse(pt[0]), float.Parse(pt[1])), float.Parse(collision.Attribute("Radius").Value))); } else if (collision.Attribute("Type").Value == "Rectangle") { string[] tl = collision.Attribute("TLPos").Value.Split(','); float tlx = float.Parse(tl[0]); float tly = float.Parse(tl[1]); string[] br = collision.Attribute("BRPos").Value.Split(','); float brx = float.Parse(br[0]); float bry = float.Parse(br[1]); sf.CollisionData.Add(new Collision_AABB( idCount++, new Vector2(tlx, tly), new Vector2(brx, bry) )); } else if (collision.Attribute("Type").Value == "OBB") { string[] c1 = collision.Attribute("Corner1").Value.Split(','); float c1x = float.Parse(c1[0]); float c1y = float.Parse(c1[1]); string[] c2 = collision.Attribute("Corner2").Value.Split(','); float c2x = float.Parse(c2[0]); float c2y = float.Parse(c2[1]); float thickness = float.Parse(collision.Attribute("Thickness").Value.ToString()); sf.CollisionData.Add(new Collision_OBB( idCount++, new Vector2(c1x, c1y), new Vector2(c2x, c2y), thickness )); } } Frames.Add(sf); } }