Exemplo n.º 1
0
    //单向输送机(垂直于高架库方向)
    #region Create_RollerConveyorGroup
    public void Create_RollerConveyorGroup(ParametersList1 PL, GameObject ConveyorGroup)
    {
        RollerConveyor_Parameter RCP = new RollerConveyor_Parameter();

        RCP.RCHigh       = PL.RCP.RCHigh - 0.1f;
        RCP.RCWidth      = PL.RCP.RCWidth;
        RCP.RCLength     = PL.MHP.HookupDistance + PL.MHP.TunnelWidth + 2 * PL.HP.Size.x - RCP.RCWidth;
        RCP.RollerRadius = PL.RCP.RollerRadius;

        GameObject         Conveyor = new GameObject();
        RollerConveyorType type     = RollerConveyorType.Intact;

        RollerConveyor.Create_RollerConveyor(RCP, Conveyor, type);
        Conveyor.name = "RollerConveyor";
        for (int i = 0; i < (PL.MHP.Num + 1) / 2 - 1; i++)
        {
            GameObject clone = Instantiate(Conveyor); clone.name = Conveyor.name + (i + 1).ToString();
            clone.transform.parent = ConveyorGroup.transform;
            float TempValue = -PL.HP.Size.x - i * (PL.HP.Size.x * 2 + PL.MHP.HookupDistance + PL.MHP.TunnelWidth);
            clone.transform.localPosition = new Vector3(TempValue, 0, 0);
            clone.transform.Rotate(0, -90, 0);
        }
        DestroyImmediate(Conveyor);
    }
Exemplo n.º 2
0
    //创建仓库场景
    #region Create_Scene
    public void Create_Scene(ParametersList1 PL, PositionsList POL, string Path)
    {
        HighStoreShelf_Parameter HP  = PL.HP;
        MultiHighBay_Parameter   MHP = PL.MHP;
        RollerConveyor_Parameter RCP = PL.RCP;
        float      TempValue1        = RCP.RCLength;
        float      TempValue2        = RCP.RCWidth;
        float      TempValue3        = TempValue2 - HP.Size.x;
        GameObject WarehouseScene    = new GameObject(); WarehouseScene.name = Name;//创建场景
        //存放货物
        GameObject Cargos = new GameObject();

        Cargos.name = "Cargos"; Cargos.transform.parent = WarehouseScene.transform;
        Cargos.transform.localPosition = new Vector3(0, 0, 0);
        //添加地面
        GameObject obj    = (GameObject)Resources.Load("Scene/Dimian");
        GameObject dimian = Instantiate(obj);
        float      Width  = HP.Size.z + 8 * RCP.RCLength;

        dimian.transform.localScale    = new Vector3(Width, 0.1f, Width);
        dimian.transform.parent        = WarehouseScene.transform;
        dimian.transform.localPosition = new Vector3(-(Width / 2 - RCP.RCLength * 4), -0.05f, -(Width / 2 - 2 * RCP.RCLength));
        //添加入口滚筒输送机
        GameObject               EnterRollerConveyor = new GameObject();
        RollerConveyorType       type = RollerConveyorType.Intact;
        RollerConveyor_Parameter RCP2 = new RollerConveyor_Parameter();

        RCP2          = PL.RCP; RCP2.RCHigh = RCP2.RCHigh - 0.1f;
        RCP2.RCLength = enterRollerLength;//长度自定义
        //RCP2.RCLength = PL.HP.Size.x * 2 + PL.MHP.HookupDistance + PL.MHP.TunnelWidth - RCP2.RCWidth;
        RollerConveyor.Create_RollerConveyor(RCP2, EnterRollerConveyor, type);
        EnterRollerConveyor.name             = "EnterRollerConveyor";
        EnterRollerConveyor.transform.parent = WarehouseScene.transform;
        EnterRollerConveyor.transform.Rotate(0, -90, 0);
        EnterRollerConveyor.transform.localPosition = new Vector3((RCP2.RCLength + TempValue3), 0, -TempValue2 / 2);
        //添加入口顶升移栽机
        LiftTransferParameter LTP = new LiftTransferParameter();

        LTP.High         = PL.RCP.RCHigh - 0.1f;
        LTP.Width        = PL.RCP.RCWidth;
        LTP.RollerRadius = PL.RCP.RollerRadius;
        LTP.GearDiameter = PL.RCP.RollerRadius * 2;
        GameObject enterLiftTransfer = new GameObject();

        LiftTransfer1.CreateLiftTransfer(enterLiftTransfer, ref LTP);
        enterLiftTransfer.name             = "EnterLiftTransfer";
        enterLiftTransfer.transform.parent = WarehouseScene.transform;
        float tempEnterX = RCP2.RCLength - (PL.HP.Size.x - LTP.Width) + LTP.Width / 2;//入口顶升的X坐标

        enterLiftTransfer.transform.localPosition = new Vector3(tempEnterX, 0, -TempValue2 / 2);
        //添加入口皮带输送机
        GameObject EnterBeltConveyors = new GameObject(); EnterBeltConveyors.name = "EnterBeltConveyors";

        Create_EnterBeltConveyors(PL, EnterBeltConveyors);
        EnterBeltConveyors.transform.parent        = WarehouseScene.transform;
        EnterBeltConveyors.transform.localPosition = new Vector3(tempEnterX, 0, 0);
        //添加顶升移载机设备
        GameObject LiftTransferGroup = new GameObject(); LiftTransferGroup.name = "LiftTransferGroup";

        Create_LiftTransferGroup(PL, LiftTransferGroup);
        LiftTransferGroup.transform.parent        = WarehouseScene.transform;
        LiftTransferGroup.transform.localPosition = new Vector3(0, 0, -TempValue2 / 2);
        //添加滚筒输送机(垂直于高架库方向)
        GameObject RollerConveyorGroup = new GameObject(); RollerConveyorGroup.name = "RollerConveyorGroup";

        Create_RollerConveyorGroup(PL, RollerConveyorGroup);
        RollerConveyorGroup.transform.parent        = WarehouseScene.transform;
        RollerConveyorGroup.transform.localPosition = new Vector3(0, 0, -TempValue2 / 2);
        //添加皮带输送机(平行于高架库方向)
        GameObject BeltConveyorGroup = new GameObject(); BeltConveyorGroup.name = "BeltConveyorGroup";

        Create_BeltConveyorGroup(PL, BeltConveyorGroup);
        BeltConveyorGroup.transform.parent        = WarehouseScene.transform;
        BeltConveyorGroup.transform.localPosition = new Vector3(0, 0, -TempValue2);
        //为场景添加高架库设备
        GameObject HighBays1 = new GameObject(); HighBays1.name = "HighBayGroup";

        HighBay2.Create_HighBays(HP, MHP, HighBays1);
        HighBays1.transform.parent        = WarehouseScene.transform;
        HighBays1.transform.localPosition = new Vector3(0, 0, -(3 * TempValue1 + TempValue2));
        //为场景添加堆垛机设备
        GameObject PilerGroup = new GameObject(); PilerGroup.name = "PilerGroup";

        Create_Pilers(PL, PilerGroup);
        PilerGroup.transform.parent        = WarehouseScene.transform;
        PilerGroup.transform.localPosition = new Vector3(0, 0, -(TempValue1 + TempValue2));
        //添加出口滚筒输送机
        GameObject ExitRollerConveyor    = new GameObject();
        RollerConveyor_Parameter exitRCP = PL.RCP;

        exitRCP.RCLength = exitRollerLength; exitRCP.RCHigh = PL.RCP.RCHigh - 0.1f;
        RollerConveyor.Create_RollerConveyor(exitRCP, ExitRollerConveyor, RollerConveyorType.Intact);
        ExitRollerConveyor.name             = "ExitRollerConveyor";
        ExitRollerConveyor.transform.parent = WarehouseScene.transform;
        int   j         = (PL.MHP.Num + 1) / 2 - 1;
        float tempExitX = -PL.HP.Size.x - j * (PL.HP.Size.x * 2 + PL.MHP.HookupDistance + PL.MHP.TunnelWidth);

        ExitRollerConveyor.transform.Rotate(0, -90, 0);
        ExitRollerConveyor.transform.localPosition = new Vector3(tempExitX, 0, -TempValue2 / 2);
        //添加出口顶升移栽机
        GameObject ExitLiftTransfer = new GameObject();

        ExitLiftTransfer.name = "ExitLiftTransfer";
        LiftTransfer1.CreateLiftTransfer(ExitLiftTransfer, ref LTP);
        ExitLiftTransfer.transform.parent = WarehouseScene.transform;
        tempExitX = tempExitX - exitRollerLength - LTP.Width / 2;
        ExitLiftTransfer.transform.localPosition = new Vector3(tempExitX, 0, -TempValue2 / 2);
        //添加出口皮带输送线
        GameObject ExitBeltConveyors = new GameObject();

        ExitBeltConveyors.name = "ExitBeltConveyors";
        Create_ExitBeltConveyors(PL, ExitBeltConveyors);
        ExitBeltConveyors.transform.parent        = WarehouseScene.transform;
        ExitBeltConveyors.transform.localPosition = new Vector3(tempExitX, 0, 0);
        //给场景添加Message
        WarehouseScene.AddComponent <ShowKeyPositionData>();
        ShowKeyPositionData ShowKeyData = WarehouseScene.GetComponent <ShowKeyPositionData>();
        KeyPositionsData    KPD         = new KeyPositionsData();

        //float[] HighValues = { 1.2f, 1.1f };
        //SI.HighValues = HighValues;
        Create_SceneInfo(ref PL, out KPD);
        ShowKeyData.KeyPositionsData = KPD;
        //Debug.Log(KPD.ConveyorLengths);
        //WarehouseScene.AddComponent<SceneData>();
        //SceneData SD = WarehouseScene.GetComponent<SceneData>();
        //Information sd = new Information(); sd.Name = "Name"; sd.Num = 2;
        ////WarehouseScene.GetComponent<SceneData>().
        //SD.IN = sd;
        GameObject Cargo = new GameObject(); Cargo.name = "Cargo";

        Cargo1.Create_Cargo(KPD.CargoSize, Cargo);
        //SD.IN.Num = 2; SD.IN.Name = "A";
        //输出场景
        MyClass.CreatePrefab(WarehouseScene, Path);
        MyClass.CreatePrefab(Cargo, path2 + Cargo.name);

        //根据参数预创建一个存储状态面板
        //GameObject StorageStateInterface = new GameObject();
        //StorageStateInterface.name = "StorageStateInterface";
        BinsPanel.Ajustment(MHP.Num, HP.FloorsNum, HP.ColumnsNum);
        BinsPanel.Ajustment2(MHP.Num, HP.FloorsNum, HP.ColumnsNum);
        //GameObject.Find("ScriptsContainer").GetComponent<MyClass>().CreatePrefab(StorageStateInterface, path2 +"Simulation/" +StorageStateInterface.name);
    }