public override void RestorerForward(History history) { if (this.Bitmap != null) { var newLayer = new SmartObjectLayer(history.SubPattern, this.LayerName, this.Bitmap, this.ObjectX, this.ObjectY, this.ObjectWidth, this.ObjectHeight); newLayer.Bitmap = Bitmap.Clone(); history.SubPattern.Layers.Insert(this.LayerIndex, newLayer); } else { var newLayer = new RasterLayer(history.SubPattern, this.LayerName); newLayer.Texture.CopyFrom(Colors); history.SubPattern.Layers.Insert(this.LayerIndex, newLayer); } }
public Snake(TextureBitmap playground) { CurrentSnakeColor = new TextureBitmap.Color(0, 0, 0, 255); Original = playground.Clone(); Playground = playground; Width = playground.Width; Height = playground.Height; int startX = Width / 2; int startY = Height / 2; for (int i = 0; i < 3; i++) { Points.Add(new TextureBitmap.Point(startX, startY + 3 - i)); } SpawnFood(); CurrentDirection = Direction.UP; LastDirection = Direction.UP; }