final
This commit is contained in:
@@ -14,7 +14,8 @@ public class SimulationModelConveyor : SimulationModel
|
||||
Vector3 startPosition;
|
||||
Vector3 endPosition;
|
||||
ConcurrentQueue<JObject> dataQueue;
|
||||
GameObject targetCargo;
|
||||
GameObject moveTargetCargo;
|
||||
GameObject storedCargo;
|
||||
int transportTime;
|
||||
float elapseTime;
|
||||
string inputQueueID;
|
||||
@@ -29,7 +30,7 @@ public class SimulationModelConveyor : SimulationModel
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if ( targetCargo != null)
|
||||
if ( moveTargetCargo != null)
|
||||
{
|
||||
startPosition = this.transform.Find(nameof(startPosition)).transform.position;
|
||||
endPosition = this.transform.Find(nameof(endPosition)).transform.position;
|
||||
@@ -38,11 +39,11 @@ public class SimulationModelConveyor : SimulationModel
|
||||
|
||||
if (elapseTime < transportTime)
|
||||
{
|
||||
targetCargo.transform.position = Vector3.Lerp(startPosition, endPosition, elapseTime / transportTime);
|
||||
moveTargetCargo.transform.position = Vector3.Lerp(startPosition, endPosition, elapseTime / transportTime);
|
||||
}
|
||||
else if ( elapseTime > transportTime )
|
||||
{
|
||||
//targetCargo = null;
|
||||
moveTargetCargo = null;
|
||||
elapseTime = 0;
|
||||
}
|
||||
|
||||
@@ -94,16 +95,17 @@ public class SimulationModelConveyor : SimulationModel
|
||||
|
||||
SimulationModelStore storeModel = (SimulationModelStore)model;
|
||||
|
||||
if ( targetCargo == null)
|
||||
if ( moveTargetCargo == null)
|
||||
{
|
||||
yield return new WaitUntil(() =>
|
||||
{
|
||||
targetCargo = storeModel.GetProduct();
|
||||
return targetCargo != null;
|
||||
moveTargetCargo = storeModel.GetProduct();
|
||||
storedCargo = moveTargetCargo;
|
||||
return moveTargetCargo != null;
|
||||
});
|
||||
|
||||
targetCargo.transform.position = startPosition;
|
||||
targetCargo.transform.rotation = Quaternion.identity;
|
||||
moveTargetCargo.transform.position = startPosition;
|
||||
moveTargetCargo.transform.rotation = Quaternion.identity;
|
||||
|
||||
}
|
||||
|
||||
@@ -148,8 +150,8 @@ public class SimulationModelConveyor : SimulationModel
|
||||
SimulationModel model = DataManager.I.GetModel(destinationID);
|
||||
SimulationModelStore storemodel = (SimulationModelStore)model;
|
||||
|
||||
storemodel.StoreProduct(targetCargo);
|
||||
targetCargo = null;
|
||||
storemodel.StoreProduct(storedCargo);
|
||||
storedCargo = null;
|
||||
}
|
||||
|
||||
else if ( rawData.Contains("_to_store"))
|
||||
@@ -163,8 +165,8 @@ public class SimulationModelConveyor : SimulationModel
|
||||
SimulationModel model = DataManager.I.GetModel(destinationID);
|
||||
SimulationModelStore storemodel = (SimulationModelStore)model;
|
||||
|
||||
storemodel.StoreProduct(targetCargo);
|
||||
targetCargo = null;
|
||||
storemodel.StoreProduct(storedCargo);
|
||||
storedCargo = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -58,8 +58,9 @@ public class SimulationModelSink : SimulationModel
|
||||
SimulationModelStore storeModel = (SimulationModelStore)model;
|
||||
while (storeModel.storedProducts.Count > queueCapacity)
|
||||
{
|
||||
Destroy(storeModel.GetProduct());
|
||||
//Destroy(storeModel.GetProduct());
|
||||
totalShipped++;
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user