wjdakf aksgdmsdlfemfdl dlTDJTdj
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RTG;
|
||||
public class SimulationModelStore : SimulationModel
|
||||
{
|
||||
public List<Transform> storePositions = new List<Transform>();
|
||||
public int maxCapacity;
|
||||
public List<GameObject> storedProducts = new List<GameObject>();
|
||||
public string storeType = "fifo";
|
||||
public List<Transform> transporterPositions = new List<Transform>();
|
||||
public void StoreProduct(GameObject product)
|
||||
{
|
||||
product.transform.parent = transform;
|
||||
for (int i = 0; i < storePositions.Count; i++)
|
||||
{
|
||||
Transform storePos = storePositions[i];
|
||||
if (storePos.childCount == 0)
|
||||
{
|
||||
product.transform.parent = storePos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
product.transform.localPosition = Vector3.zero;
|
||||
product.transform.localRotation = Quaternion.identity;
|
||||
storedProducts.Add(product);
|
||||
if (storedProducts.Count > maxCapacity)
|
||||
Debug.LogWarning("Max Capacity " + maxCapacity + " Reached on : " + nodeID);
|
||||
}
|
||||
public GameObject GetProduct()
|
||||
{
|
||||
if (storedProducts.Count == 0)
|
||||
return null;
|
||||
if (storeType.Contains("fifo"))
|
||||
{
|
||||
GameObject product = storedProducts[0];
|
||||
storedProducts.Remove(product);
|
||||
return product;
|
||||
}
|
||||
else if (storeType.Contains("lifo"))
|
||||
{
|
||||
GameObject product = storedProducts[storedProducts.Count - 1];
|
||||
storedProducts.Remove(product);
|
||||
return product;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public Transform GetTransporterPosition()
|
||||
{
|
||||
if (transporterPositions.Count == 0)
|
||||
return null;
|
||||
return transporterPositions[UnityEngine.Random.Range(0, transporterPositions.Count)];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user