This commit is contained in:
2025-11-04 19:02:01 +09:00
parent bb7ed2d6dc
commit 107da72dee
17 changed files with 2259 additions and 54 deletions

View File

@@ -1,6 +1,4 @@
using Simulator.Model;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UVC.Data.Core;
@@ -30,14 +28,14 @@ namespace Simulator.Data {
var y = (int)coordinates.GetInt("y");
var z = (int)coordinates.GetInt("z");
var entity=EntityManager.Instance.GetEntities(entityids,this);
entity[0].transform.SetParent(cellComponents[(x, z, y)].Socket.transform);
entity[0].transform.SetParent(cellComponents[(x, y, z)].Socket.transform);
entity[0].transform.localPosition = new Vector3(0, 0, 0);
entitys.Add(entity[0].gameObject);
}
public void SpawnCell(rack_layout layout,bool asrs)
{
Vector3 center = new Vector3(layout.x * layout.x_length / 2f, 0f, layout.y * layout.y_length / 2f);
Vector3 center = new Vector3(layout.x * layout.x_length / 2f, 0f, layout.z * layout.z_length / 2f);
transform.position = center;
for (int z = 0; z < layout.z; z++)
@@ -47,25 +45,28 @@ namespace Simulator.Data {
for(int x=0;x<layout.x; x++)
{
var cell = Instantiate(cellPrefab);
cell.transform.localScale=new Vector3(layout.x_length, layout.z_length, layout.y_length);
cell.transform.localScale=new Vector3(layout.x_length, layout.y_length, layout.z_length);
cell.transform.position = new Vector3(layout.x_length * x*0.55f, layout.y_length * y * 0.59f, layout.z_length * z * 0.75f);
cell.transform.parent = this.transform;
cell.transform.position = new Vector3(layout.x_length * x*0.55f, layout.z_length * z * 0.55f, layout.y_length * y * 0.55f);
cellComponents.Add((x, z, y), cell.GetComponent<CellComponent>());
cellComponents.Add((x, y, z), cell.GetComponent<CellComponent>());
cellComponents[(x, y, z)].x = x;
cellComponents[(x, y, z)].y = y;
cellComponents[(x, y, z)].z = z;
}
}
}
if (asrs)
{
var pickcell = Instantiate(cellPrefab);
pickcell.transform.localScale = new Vector3(layout.x_length, layout.z_length, layout.y_length);
pickcell.transform.localScale = new Vector3(layout.x_length, layout.y_length, layout.z_length);
pickcell.transform.position = new Vector3(layout.x_length * -0.55f, layout.y_length * 0, layout.z_length * 0);
pickcell.transform.parent = this.transform;
pickcell.transform.position = new Vector3(layout.x_length * -0.55f, layout.z_length * 0, layout.y_length * 0);
cellComponents.Add((-1, 0, 0), pickcell.GetComponent<CellComponent>());
var dropcell = Instantiate(cellPrefab);
dropcell.transform.localScale = new Vector3(layout.x_length, layout.z_length, layout.y_length);
dropcell.transform.localScale = new Vector3(layout.x_length, layout.y_length, layout.z_length);
dropcell.transform.position = new Vector3(layout.x_length * (layout.x)*0.55f, layout.y_length * 0, layout.z_length * 0);
dropcell.transform.parent = this.transform;
dropcell.transform.position = new Vector3(layout.x_length * (layout.x+ 0.55f), layout.z_length * 0, layout.y_length * 0);
cellComponents.Add(((int)(layout.x + 1), 0, 0), dropcell.GetComponent<CellComponent>());
cellComponents.Add(((int)(layout.x), 0, 0), dropcell.GetComponent<CellComponent>());
}
}
}