//Purchases the object public void Buy() { sc = GameObject.Find("ViveCurvePointers").GetComponent <SmashController>(); sc.food.totMat -= food; sc.wood.totMat -= wood; sc.stone.totMat -= stone; }
public void SmashController_SlowThreadTest() { int iteration = 1; SmashController sc = new SmashController(); // Put jobs into the queue int Counter1 = 0; sc.Enqueue(iteration, (t, i) => { System.Threading.Thread.Sleep(3000); Counter1++; return(true); }); int Counter2 = 0; sc.Enqueue(iteration, (t, i) => { System.Threading.Thread.Sleep(3000); Counter2++; return(true); }); // Run Assert.True(sc.Run()); // Check output Assert.Equal(iteration, Counter1); Assert.Equal(iteration, Counter2); // output result, check test output this.output.WriteLine(sc.ToString()); }
void Start() { menu = transform.GetChild(0).gameObject; wood = menu.transform.GetChild(1).GetComponent <TextMesh>(); food = menu.transform.GetChild(2).GetComponent <TextMesh>(); stone = menu.transform.GetChild(3).GetComponent <TextMesh>(); sc = GameObject.Find("ViveCurvePointers").GetComponent <SmashController>(); }
//Returns true if the player has enough resources to purchase public bool CheckPrice() { sc = GameObject.Find("ViveCurvePointers").GetComponent <SmashController>(); if (sc.food.totMat >= food && sc.wood.totMat >= wood && sc.stone.totMat >= stone) { return(true); } GameObject.Find("ViveCurvePointers").GetComponent <SmashController>().hud.SendMsg("Not enough resources", 1.0f, Color.red); return(false); }
public void SmashController_LotsOfThreadTest() { int threads = 250; int iteration = 1; SmashController sc = new SmashController(); for (int i = 0; i < threads; ++i) { // Put jobs into the queue sc.Enqueue(iteration, (t, it) => { System.Threading.Thread.Sleep(3000); return(true); }); } // Run Assert.True(sc.Run()); // output result, check test output this.output.WriteLine(sc.ToString()); }
private void Start() { sc = GameObject.Find("ViveCurvePointers").GetComponent <SmashController>(); }