private IEnumerator AddXZArrayToMap(int[,] anyArray, int arrayX, int arrayY, int x, int y, int height)
        {
            for (var i = 0; i < arrayX; i++)
            {
                for (var j = 0; j < arrayY; j++)
                {
                    if (anyArray[arrayX - i - 1, j] != 0)
                    {
                        worldManager.CreateBlock(height + i, x + j, y, anyArray[arrayX - i - 1, j]);
                    }
                    yield return(new WaitForFixedUpdate());

                    yield return(new WaitForFixedUpdate());
                }
                yield return(new WaitForFixedUpdate());
            }
        }
示例#2
0
        public bool Place(WorldManager worldManager, Vector3 pos)
        {
            switch (placeType)
            {
            case PlaceType.Block:
                //从当前 WorldManager LayerID
                var layerID = worldManager.blockStorageData.BlockMapping.Find(val => val.blockData?.name == blockData.name).layerID;
                worldManager.CreateBlock((int)pos.y, (int)pos.x, (int)pos.z, layerID);

                return(true);

            case PlaceType.Item:
                if (worldManager.GetItemData(pos + itemPos) == null)
                {
                    worldManager.CreatePlaceableInventory(this, pos + itemPos, Vector3.zero);
                    return(true);
                }
                break;
            }
            return(false);
        }