// 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);
    }
Beispiel #2
0
    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 BeltItemGFXProcesorCheck()
        {
            // Arrange
            List <BeltItem> beltItems = new List <BeltItem>();

            beltItems.Add(new GameObject().AddComponent <BeltItem>().GetComponent <BeltItem>());
            beltItems[0].transform.position = Vector3.zero;

            beltItems[0].mySlot = new BeltItemSlot(Vector3.zero + Vector3.forward * BeltObject.beltItemSlotDistance);

            BeltItemGfxUpdateProcessor myBeltItemGfxProcessor = new BeltItemGfxUpdateProcessor(beltItems);

            // Act
            myBeltItemGfxProcessor.UpdateBeltItemGfxs(2f, 0.25f);

            // Assert
            Assert.AreEqual(Vector3.Distance(beltItems[0].transform.position, (Vector3.forward * BeltObject.beltItemSlotDistance) / 2f), 0f, 0.05f);

            // Act
            myBeltItemGfxProcessor.UpdateBeltItemGfxs(2f, 0.25f);

            // Assert
            Assert.AreEqual(Vector3.Distance(beltItems[0].transform.position, (Vector3.forward * BeltObject.beltItemSlotDistance)), 0f, 0.05f);
        }