72 lines
1.9 KiB
C#
72 lines
1.9 KiB
C#
using Gpm.Ui.Sample;
|
|
using Simulator.Data;
|
|
using System.Collections.Generic;
|
|
using System.Security.Cryptography;
|
|
using UnityEngine;
|
|
using UVC.Data.Core;
|
|
|
|
public class ASRSComponent : ComponentBase
|
|
{
|
|
ASRSDataClass asrsData = new ASRSDataClass();
|
|
public RackComponent rack;
|
|
public StackerCrane stacker;
|
|
public GameObject inputPort;
|
|
public GameObject outputPort;
|
|
|
|
public void SetComponent(ASRSDataClass asrsData)
|
|
{
|
|
this.asrsData = asrsData;
|
|
data = asrsData;
|
|
SetRack(asrsData.asrs_layout);
|
|
SetStackerCrane(asrsData.asrs_layout);
|
|
SetPort(asrsData.shipping_port_position, inputPort);
|
|
SetPort(asrsData.receive_port_position, outputPort);
|
|
FitCollider();
|
|
}
|
|
|
|
public override void GetModelData(DataObject modelData)
|
|
{
|
|
var name = modelData.GetString("event_name");
|
|
if (string.Equals(name,"moving"))
|
|
{
|
|
stacker.SetTargetPosition(modelData,rack);
|
|
}
|
|
if (string.Equals(name, "fork_operation"))
|
|
{
|
|
stacker.SetForkPosition(modelData,rack);
|
|
}
|
|
if (string.Equals(name, "arrived"))
|
|
{
|
|
rack.GetModelData(modelData);
|
|
}
|
|
if (string.Equals(name, "receiving_request_added"))
|
|
{
|
|
rack.SetASRSQueue(modelData);
|
|
}
|
|
if (string.Equals(name, "inventory_initialized"))
|
|
{
|
|
rack.InitializeQueue(modelData);
|
|
}
|
|
}
|
|
|
|
public void SetRack(rack_layout layout)
|
|
{
|
|
rack.SpawnCell(layout,true);
|
|
}
|
|
|
|
void SetPort(ReceivePortPosition portPosition,GameObject port)
|
|
{
|
|
port.transform.localPosition = ToVector3(portPosition.position);
|
|
}
|
|
|
|
void SetStackerCrane(rack_layout layout)
|
|
{
|
|
stacker.SetPosition(layout);
|
|
}
|
|
|
|
private Vector3 ToVector3(Position p)
|
|
{
|
|
return new Vector3(p.x, p.z, -p.y);
|
|
}
|
|
}
|