// Start is called before the first frame update void Start() { s = this; allBelts = new List <BeltObject>(FindObjectsOfType <BeltObject>()); allCreators = new List <MagicItemCreator>(FindObjectsOfType <MagicItemCreator>()); allDestroyers = new List <MagicItemDestroyer>(FindObjectsOfType <MagicItemDestroyer>()); foreach (BeltObject belt in allBelts) { belt.SetPosBasedOnWorlPos(); belt.GetComponent <BeltGfx>().UpdateGraphics(belt.beltInputs, belt.beltOutputs); allBeltsCoords[belt.pos] = belt; } beltPreProc = new BeltPreProcessor(beltGroups, allBeltItems, GetBeltAtLocation); beltItemSlotProc = new BeltItemSlotUpdateProcessor(allBeltItems, beltGroups); beltItemGfxProc = new BeltItemGfxUpdateProcessor(allBeltItems); print("Belt Count = " + allBelts.Count.ToString()); allResults.Add("Belt Count = " + allBelts.Count.ToString()); allResults.Add("Trial Counts: " + "Prepass - " + prePassTrialCount.ToString() + ", Update Slot - " + updateSlotTrialCount.ToString() + ", Update Gfx - " + updateGfxTrialCount.ToString()); var temp = Time.realtimeSinceStartup; TestStartupTime(); TestBeltSlotUpdateTime(); TestBeltSlotGfxUpdateTime(); temp = Time.realtimeSinceStartup - temp; print("Total test time: " + (temp).ToString("f6")); allResults.Add("Total test time: " + (temp).ToString("f6")); int n = 0; foreach (string s in allResults) { print(s); if (n < textses.Length) { textses[n].text = s; } n++; } TimingTestRunSaver.WriteTestRunDataToFile(allResults); }
public void BeltPrePassCheck() { // Arrange List <BeltObject> allBelts = new List <BeltObject>(); List <BeltPreProcessor.BeltGroup> beltGroups = new List <BeltPreProcessor.BeltGroup>(); List <BeltItem> allBeltItems = new List <BeltItem>(); // Act BeltPreProcessor beltProc = new BeltPreProcessor(beltGroups, allBeltItems, (int x, int y) => null); beltProc.PrepassBelts(allBelts); // Assert }
public void SetupBeltSystem() { allBelts = new List <BeltObject>(FindObjectsOfType <BeltObject>()); for (int i = 0; i < allBelts.Count; i++) { BeltObject belt = allBelts[i]; belt.SetPosBasedOnWorlPos(); allBeltsCoords[belt.pos] = belt; } beltPreProc = new BeltPreProcessor(beltGroups, allBeltItems, GetBeltAtLocation); beltPreProc.PrepassBelts(allBelts); beltItemSlotProc = new BeltItemSlotUpdateProcessor(itemPool, beltGroups); }
public void SetupBeltSystem() { allBelts = new List <BeltObject>(FindObjectsOfType <BeltObject>()); foreach (BeltObject belt in allBelts) { belt.SetPosBasedOnWorlPos(); belt.GetComponent <BeltGfx>().UpdateGraphics(belt.beltInputs, belt.beltOutputs); } beltProc = new BeltPreProcessor(allBelts, beltGroups, allBeltItemsSlots, beltItemSlotGroups, allBeltItems, GetBeltAtLocation); beltProc.PrepassBelts(); beltItemSlotProc = new BeltItemSlotUpdateProcessor(allBeltItems, beltItemSlotGroups); beltItemGfxProc = new BeltItemGfxUpdateProcessor(allBeltItems); }
public void BeltPrePassCheck() { // Arrange List <BeltObject> allBelts = new List <BeltObject>(); allBelts.Add(new GameObject().AddComponent <BeltObject>().GetComponent <BeltObject>()); allBelts.Add(new GameObject().AddComponent <BeltObject>().GetComponent <BeltObject>()); allBelts[0].pos.x = 0; allBelts[0].beltOutputs[1] = true; allBelts[1].pos.x = 1; allBelts[1].beltInputs[3] = true; List <BeltPreProcessor.BeltGroup> beltGroups = new List <BeltPreProcessor.BeltGroup>(); List <BeltItem> allBeltItems = new List <BeltItem>(); // Act BeltPreProcessor beltProc = new BeltPreProcessor(beltGroups, allBeltItems, (BeltObject.Position pos) => { return(pos.x == 0 ? allBelts[0] : allBelts[1]); }); beltProc.PrepassBelts(allBelts); // Assert Assert.IsTrue(allBelts[0].myBeltItemSlots[3, 1].outsideConnections.Count > 0); }