コード例 #1
0
        /// <summary>
        /// Removes an unit fcrom current item in player inventory and throws it into the scene
        /// </summary>
        public void ThrowCurrentItem(Vector3 playerPos, Vector3 direction)
        {
            InventoryItem inventoryItem = player.ConsumeItem();

            if (inventoryItem == InventoryItem.Null)
            {
                return;
            }

            if (inventoryItem.item.category == ItemCategory.Voxel)
            {
                env.VoxelThrow(playerPos, direction, 15f, inventoryItem.item.voxelType, Misc.color32White);
            }
            else if (inventoryItem.item.category == ItemCategory.General)
            {
                env.ItemThrow(playerPos, direction, 15f, inventoryItem.item);
            }
        }