/** * Collect the correct points depending on the block mined. * @param block The block the player occupies. */ public void Collect(string block) { if (block == "Gold") { points = 10; } else if (block == "Diamond") { points = 20; } else { points = 0; } fuelBehaviour.UpdateDollars(points); }
public IEnumerator CannotBuyWithoutDollars() { GameObject digger = IntegrationTestScript.TestDigger(); FuelBehaviour fb = digger.GetComponent <FuelBehaviour>(); fb.dollars = 0; yield return(null); fb.UpdateDollars(10); int initialDollars = fb.dollars; Assert.AreEqual(10, initialDollars); fb.Refuel(); Assert.AreEqual(fb.dollars, initialDollars - 5); fb.Refuel(); Assert.AreEqual(fb.dollars, 0); int endingFuel = fb.fuel; fb.Refuel(); Assert.AreEqual(fb.dollars, 0); Assert.AreEqual(fb.fuel, endingFuel); }