public Level(Map map) { for (int i = 0; i < this.map.Length; ++i ) { for (int j = 0; j < this.map[i].Length; ++j) { this.map[i][j] = map.GetInternalForm()[i][j];// TODO: thinks, there is better variant... } } }
public Level(Map map) { for (int i = 0; i < this.map.Length; ++i) { for (int j = 0; j < this.map[i].Length; ++j) { this.map[i][j] = map.GetInternalForm()[i][j];// TODO: thinks, there is better variant... } } }
public void drawMap(Map map) { GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.ClearColor(Color.Black); for (int i = 0; i < map.GetInternalForm().Length; i++) for (int j = 0; j < map.GetInternalForm()[i].Length; j++) switch (map.GetInternalForm()[i][j].Type) { case MapObject.Types.EMPTY: DrawMapPart(i, j, 0); break; case MapObject.Types.BRICK: DrawMapPart(i, j, 1); break; case MapObject.Types.CONCRETE: DrawMapPart(i, j, 2); break; case MapObject.Types.WATER: DrawMapPart(i, j, 3); break; case MapObject.Types.FOREST: DrawMapPart(i, j, 4); break; case MapObject.Types.BASE: DrawMapPart(i, j, 5); break; } }
public void CreateXMLDoc(String filePath) { XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = "\t"; settings.NewLineChars = "\n"; //settings.OmitXmlDeclaration = true; // "<?xml version="1.0" encoding="utf-8"?>" //writer = new XmlTextWriter(filePath, Encoding.Unicode); writer = XmlWriter.Create(filePath, settings); writer.WriteStartDocument(); writer.WriteStartElement("map"); // //writer.WriteStartElement("name"); //Writing name of the mode writer.WriteStartElement("mode"); writer.WriteAttributeString("name", mode.mode.ToString()); //writer.WriteAttributeString("name", mode.getName()); writer.WriteEndElement(); //Writing map structure block writer.WriteStartElement("structure"); // //MapObject[][] tempMapObject = map.GetInternalForm(); foreach (MapObject[] m in map.GetInternalForm()) { for (int j = 0; j < m.Length; j++) { writer.WriteStartElement("element"); writer.WriteAttributeString("x", m[j].X.ToString()); writer.WriteAttributeString("y", m[j].Y.ToString()); writer.WriteAttributeString("type", m[j].Type.ToString()); writer.WriteEndElement(); } } writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); }