void CreateMarkers(Chunk _chunk, String _ArtPack) { PaletteItem[] itemArray = new PaletteItem[0]; if (_ArtPack.Length > 0) { itemArray = Resources.LoadAll <PaletteItem> (_ArtPack); } if (itemArray.Length < 1) { itemArray = Resources.LoadAll <PaletteItem> (PathCollect.pieces); } ChunkData cData = _chunk.cData; foreach (BlockAir bAir in cData.blockAirs) { for (int i = 0; i < bAir.pieceNames.Length; i++) { for (int k = 0; k < itemArray.Length; k++) { if (bAir.pieceNames [i] == itemArray [k].name) { PlacePiece( bAir.BlockPos, new WorldPos(i % 3, 0, (int)(i / 3)), itemArray [k].gameObject.GetComponent <LevelPiece> (), _chunk.transform); } } } } }
private void UpdateCurrentPieceInstance(PaletteItem item, Texture2D preview) { _itemSelected = item; _itemPreview = preview; _pieceSelected = (LevelPiece)item.GetComponent <LevelPiece> (); Repaint(); }
private void GetSelectedItem(int index) { if (index != -1) { PaletteItem selectedItem = _categorizedItems[_categorySelected][index]; Debug.Log("Selected Item is: " + selectedItem.itemName); if (ItemSelectedEvent != null) { ItemSelectedEvent(selectedItem, _previews[selectedItem]); } } }