Initial Commit

This commit is contained in:
2026-05-28 10:16:15 +01:00
commit 405ae3b309
13091 changed files with 2149948 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
using System.Collections.Generic;
using UnityEngine;
public class ShelfSpaceController : MonoBehaviour
{
public StockInfo info;
public int amountOnShelf;
public List<StockObject> objectsOnShelf;
public void PlaceStock(StockObject objectToPlace)
{
if (objectToPlace == null) return;
// If the shelf is empty, initialize it with the item's info
//if (amountOnShelf == 0)
if(objectsOnShelf.Count == 0)
{
info = objectToPlace.info;
}
// Otherwise, verify that the item matches the shelf's assigned stock type
else if (info == null || info.name != objectToPlace.info.name)
{
return; // Name mismatch or info missing, exit early
}
// Parent the object to the shelf and trigger the placement logic
objectToPlace.transform.SetParent(transform);
objectToPlace.MakePlaced();
//amountOnShelf++;
objectsOnShelf.Add(objectToPlace);
}
public StockObject Getstock()
{
StockObject stockToReturn = null;
if(objectsOnShelf.Count > 0)
{
stockToReturn = objectsOnShelf[objectsOnShelf.Count - 1];
objectsOnShelf.RemoveAt(objectsOnShelf.Count - 1);
}
return stockToReturn;
}
}