Пример #1
0
    internal void PickUp(Vector3Int gridPosition)
    {
        Vector2Int position = (Vector2Int)gridPosition;

        if (crops.ContainsKey(position) == false)
        {
            return;
        }

        CropTile cropTile = crops[position];

        if (cropTile.Complete)
        {
            int dropCount = cropTile.crop.dropCount;
            while (dropCount > 0)
            {
                dropCount -= 1;
                Vector3Int position2 = gridPosition;
                position2.x += (int)(scattering_level * UnityEngine.Random.value - scattering_level / 2);
                position2.y += (int)(scattering_level * UnityEngine.Random.value - scattering_level / 2);

                ItemSpawnManager.instance.SpawnItem(targetTilemap.CellToWorld(position2), cropTile.crop.yield, cropTile.crop.count, true);
            }



            targetTilemap.SetTile(gridPosition, plowed);
            cropTile.Harvested();
        }
    }
    internal void PickUp(Vector3Int gridPosition)
    {
        Vector2Int position = (Vector2Int)gridPosition;

        if (crops.ContainsKey(position) == false)
        {
            return;
        }

        CropTile cropTile = crops[position];

        if (cropTile.Complete)
        {
            ItemSpawnManager.instance.SpawnItem(targetTilemap.CellToWorld(gridPosition), cropTile.crop.yield, cropTile.crop.count);

            targetTilemap.SetTile(gridPosition, plowed);
            cropTile.Harvested();
        }
    }