public IEnumerator Test_ItemDropTextNotShownIfPlayerTooFar() { Player player = CreatePlayer(); ItemDrop drop = CreateItemDrop(); drop.transform.position = new Vector3(drop.maxDisplayDistance + 1, 0, 0); drop.player = player; Canvas canvas = drop.GetComponentInChildren <Canvas>(); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); Assert.IsFalse(canvas.gameObject.activeSelf, "Item drop text was shown even though player was too far away!"); }
public IEnumerator Test_ItemDropTextIndicatesFullInventory() { Player player = CreatePlayer(); player.inventory.MaxItemSlots = 0; ItemDrop drop = CreateItemDrop(); drop.player = player; TextMeshProUGUI text = drop.GetComponentInChildren <TextMeshProUGUI>(); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); Assert.IsTrue(text.text == "Inventory full!", "Item drop text did not inform the player about full inventory!"); player.inventory.MaxItemSlots = 1; yield return(new WaitForEndOfFrame()); Assert.IsFalse(text.text == "Inventory full!", "Item drop text did not get set back to the normal text!"); }