public void CanAddTileTypeWithoutPrefab() { LayerData ld = new LayerData(null, "SuperLayer", 1, 1); TileType type = new TileType(1); Point2 position = new Point2(0, 0); bool result = ld.AddTile(position, type); Assert.IsTrue(result); Assert.IsNotNull(ld[position]); }
public void CanAddTileTypeWithPrefab() { LayerData ld = new LayerData(null, "SuperLayer", 1, 1); GameObject go = new GameObject("TestGo"); TileType type = new TileType(1,go); Point2 position = new Point2(0, 0); bool result = ld.AddTile(position, type); Assert.IsTrue(result); Assert.IsNotNull(ld[position]); Assert.IsNotNull(ld[position].GameObject); }
private void readLayerLine(LayerData layer, int y, int lineWidth) { for (int x = 0; x < lineWidth; x++) { int value = readNextInt(); int id = ArchitectRotationHandler.RemoveRotationFlags(value); int rotationFlags = ArchitectRotationHandler.GetRotationFlags(value); Point2 position = new Point2(x, y); TileType tileType = null; if (id == 0) { continue; } tileType = linker.Tilesets[0][id - 1]; layer.AddTile(position, tileType, rotationFlags); } }
public LayerData Clone() { LayerData newLayer = (LayerData)MemberwiseClone(); newLayer.tiles = new TileData[LayerWidth * LayerHeight]; newLayer.tiles.Fill(TileData.Empty); GameObject newLayerGameObject = new GameObject(LayerTransform.name + " Copie"); newLayerGameObject.transform.parent = LayerTransform.parent; newLayer.LayerTransform = newLayerGameObject.transform; for (int y = 0; y < LayerHeight; y++) { for (int x = 0; x < LayerWidth; x++) { newLayer.AddTile(new Point2(x, y), this[x, y]); } } return(newLayer); }
/*public void setSelectedTile(int id) * { * SelectedTileType = Linker.Tilesets[0].Tiles[id - 1]; * } * * public void AddSelectedTileType(LayerData layer, Vector3 worldP, Point2 tilePoint) * { * layer.AddTile(tilePoint, toolControler.SelectedTileType, toolControler.RotationFlip); * }*/ /*public void AddTile(LayerData layer, Vector3 worldP, Point2 tilePoint, TileType tileType) * { * layer.AddTile(tilePoint, tileType, toolControler.RotationFlip); * }*/ public void AddTile(LayerData layer, Vector3 worldP, Point2 tilePoint, TileType tileType, ArchitectRotationFlip RotationFlip) { layer.AddTile(tilePoint, tileType, RotationFlip); }
private void readLayerLine(LayerData layer, int y, int lineWidth) { for (int x = 0; x < lineWidth; x++) { int value = readNextInt(); int id = ArchitectRotationHandler.RemoveRotationFlags(value); int rotationFlags = ArchitectRotationHandler.GetRotationFlags(value); Point2 position = new Point2(x, y); TileType tileType = null; if (id == 0) continue; tileType = linker.Tilesets[0][id - 1]; layer.AddTile(position, tileType, rotationFlags); } }
/*public void setSelectedTile(int id) { SelectedTileType = Linker.Tilesets[0].Tiles[id - 1]; } public void AddSelectedTileType(LayerData layer, Vector3 worldP, Point2 tilePoint) { layer.AddTile(tilePoint, toolControler.SelectedTileType, toolControler.RotationFlip); }*/ /*public void AddTile(LayerData layer, Vector3 worldP, Point2 tilePoint, TileType tileType) { layer.AddTile(tilePoint, tileType, toolControler.RotationFlip); }*/ public void AddTile(LayerData layer, Vector3 worldP, Point2 tilePoint, TileType tileType, ArchitectRotationFlip RotationFlip) { layer.AddTile(tilePoint, tileType, RotationFlip); }