示例#1
0
        public AssemblerData addAssembler(Vector3 pos)
        {
            AssemblerData p = new AssemblerData();

            assemblers.Add(p);

            GameObject go   = GameObject.Instantiate(assemblerPrefab, pos, Quaternion.identity) as GameObject;
            Assembler  comp = go.GetComponent <Assembler>();

            comp.target = p;
            assemblerGO.Add(comp);
            return(p);
        }
示例#2
0
        private void Start()
        {
            SystemUpdate.self.RegisterPerFrameUpdate(this);
            for (int i = 0; i < line_count; ++i)
            {
                ProducerData  gen   = addGeneratorCheat(new Vector3(0f, 0f, i * 2f), 1, 9999);
                BeltData      belt  = addBelt(new Vector3(4f, 0f, i * 2f), new Vector3(12f, 0f, i * 2f));
                AssemblerData assem = addAssembler(new Vector3(16f, 0, i * 2f));
                assem.setReqItems(new ushort[] { 1 }, new ushort[] { 2 });
                //assem.req_itemIds[0] = 1;
                //assem.req_Count[0] = 2;
                assem.productItemId    = 2;
                assem.productItemCount = 1;
                assem.cycleDuration    = 3f;
                StorageData stor = addStorage(new Vector3(20f, 0, i * 2f));

                InserterData ins = addInserter(new Vector3(2f, 0f, i * 2f));
                ins.source = gen;
                ins.target = belt;
                //ins.targetPos = 0f;
                ins.expectedItemId = 1;

                InserterData ins2 = addInserter(new Vector3(14f, 0, i * 2f));
                ins2.source = belt;
                //ins2.sourcePos = 8f;
                ins2.target         = assem;
                ins2.expectedItemId = 1;


                InserterData ins3 = addInserter(new Vector3(18f, 0, i * 2f));
                ins3.source         = assem;
                ins3.target         = stor;
                ins3.expectedItemId = 2;



                SimDataUtility.addPair(gen, ins);
                SimDataUtility.addInserterToBelt(belt, ins, 0f);
                SimDataUtility.addInserterToBelt(belt, ins2, 8f);
                SimDataUtility.addPair(assem, ins2);
                SimDataUtility.addPair(assem, ins3);
                SimDataUtility.addPair(stor, ins3);

                gen.wakeup();
                ins.wakeup();
                ins2.wakeup();
                ins3.wakeup();
                assem.wakeup();
                belt.wakeup();
            }
        }