public ObjectTemplate Clone() { return(new ObjectTemplate( Objects.Select(original => { var clone = new ScriptObject() { X = original.X, Y = original.Y, Z = original.Z, Rotation = original.Rotation, RoadOptions = original.RoadOptions, Type = original.Type }; foreach (var property in original.Properties) { clone.Properties.Add(property.Key, new Property() { Name = property.Value.Name, Type = property.Value.Type, Value = property.Value.Value }); } return clone; }).ToArray(), BlockedTiles.Select(t => new Point(t.X, t.Y)).ToArray()) { Tiles = Tiles, Map = Map }); }
private void CalculatePositions() { if (Objects.Any()) { Point origin = CalculateOrigin(); foreach (var obj in Objects) { obj.X -= origin.X; obj.Y -= origin.Y; } } BlockedTiles = BlockedTiles.Select(t => t - origin).ToArray(); }