WuhuIslandTesting/Library/PackageCache/com.stresslevelzero.marrow.sdk@1.2.0/Scripts/SLZ.Marrow/SLZ.Marrow.Warehouse/PalletReference.cs
2025-01-07 02:06:59 +01:00

51 lines
No EOL
1.1 KiB
C#

using System;
using UnityEngine;
namespace SLZ.Marrow.Warehouse
{
[Serializable]
public class PalletReference : ScannableReference<Pallet>
{
public PalletReference() : base(Warehouse.Barcode.EmptyBarcode())
{
}
public PalletReference(Barcode barcode) : base(barcode)
{
}
public PalletReference(string barcode) : base(barcode)
{
}
public Pallet Pallet
{
get
{
TryGetPallet(out var retPallet);
return retPallet;
}
}
public bool TryGetPallet(out Pallet pallet)
{
pallet = null;
bool success = false;
if (AssetWarehouse.ready)
{
success = AssetWarehouse.Instance.TryGetPallet(Barcode, out pallet);
}
return success;
}
public static bool IsValid(PalletReference palletReference)
{
return palletReference != null && Barcode.IsValid(palletReference.Barcode);
}
}
}