public Hero(int startPosX, int startPosY, String style) { this.posX = startPosX; this.posY = startPosY; if (style.Contains("retro")) { this.graphics = GraphicManager.GetInstance().GetTexture(@"Map\heroDownR.png"); } else if (style.Contains("classic")) { this.graphics = GraphicManager.GetInstance().GetTexture(@"Map\heroDown.png"); } picturebox = new PictureBox(); picturebox.Height = 64; picturebox.Width = 64; point = new Point(this.posX, this.posY); picturebox.Image = this.graphics; picturebox.Location = point; numberSteps = 0; Factory = new FactoryMapPart(); }
public MapBuilder() { map = new Map(); factory = new FactoryMapPart(); singleMapElementLine = new List <Part>(); }
private List <List <Part> > convertMapFromMemento(List <List <int> > map) { List <List <Part> > state = new List <List <Part> >(); int posX = 0; int posY = 0; FactoryMapPart factory = new FactoryMapPart(); foreach (List <int> list in map) { int lineElementCounter = 0; List <Part> singleLine = new List <Part>(); foreach (int part in list) { if (part == 5) { lineElementCounter++; singleLine.Add(factory.produceHero(posX, posY, newMap.getStyle())); } if (part == 6) { singleLine.Add(factory.produceBox(posX, posY, newMap.getStyle())); lineElementCounter++; } if (part == 1) { singleLine.Add(factory.produceEmpty(posX, posY, newMap.getStyle())); lineElementCounter++; } if (part == 2) { singleLine.Add(factory.produceWall(posX, posY, newMap.getStyle())); lineElementCounter++; } if (part == 4) { singleLine.Add(factory.produceBoxPoint(posX, posY, newMap.getStyle())); lineElementCounter++; } if (part == 3) { singleLine.Add(factory.produceFloor(posX, posY, newMap.getStyle())); lineElementCounter++; } posX = posX + 64; } posY = posY + 64; posX = posX - (64 * lineElementCounter); state.Add(singleLine); } return(state); }