public IEnumerator TakesTest2() { SceneManager.LoadScene("Game"); yield return(null); GameObject.Find("Game Manager").SendMessage("AddGameTask", "player create 2 'Gold'"); GameObject.Find("Game Manager").SendMessage("AddGameTask", "player puts 2 'Gold' 'Inn Floor 1 Room 1' 'Bar Front'"); GameObject.Find("Game Manager").SendMessage("AddGameTask", "hamen create 2 'Silver'"); GameObject.Find("Game Manager").SendMessage("AddGameTask", "hamen puts 2 'Silver' 'Inn Floor 1 Room 1' 'Bar Front'"); yield return(new WaitForSeconds(10.0f)); GameObject.Find("Game Manager").SendMessage("AddGameTask", "player takes 1 'Gold' 'Inn Floor 1 Room 1' 'Bar Front'"); GameObject.Find("Game Manager").SendMessage("AddGameTask", "player takes 1 'Silver' 'Inn Floor 1 Room 1' 'Bar Front'"); GameObject.Find("Game Manager").SendMessage("AddGameTask", "hamen takes 1 'Silver' 'Inn Floor 1 Room 1' 'Bar Front'"); GameObject.Find("Game Manager").SendMessage("AddGameTask", "hamen takes 1 'Gold' 'Inn Floor 1 Room 1' 'Bar Front'"); yield return(new WaitForSeconds(10.0f)); GameObject.Find("Game Manager").SendMessage("AddGameTask", "player puts 1 'Gold' 'Inn Floor 1 Room 1' 'Bar Front'"); GameObject.Find("Game Manager").SendMessage("AddGameTask", "player puts 1 'Silver' 'Inn Floor 1 Room 1' 'Bar Front'"); GameObject.Find("Game Manager").SendMessage("AddGameTask", "hamen puts 1 'Silver' 'Inn Floor 1 Room 1' 'Bar Front'"); GameObject.Find("Game Manager").SendMessage("AddGameTask", "hamen puts 1 'Gold' 'Inn Floor 1 Room 1' 'Bar Front'"); yield return(new WaitForSeconds(10.0f)); GameObject.Find("Game Manager").SendMessage("AddGameTask", "player takes 2 'Gold' 'Inn Floor 1 Room 1' 'Bar Front'"); GameObject.Find("Game Manager").SendMessage("AddGameTask", "hamen takes 2 'Silver' 'Inn Floor 1 Room 1' 'Bar Front'"); yield return(new WaitForSeconds(10.0f)); GameObject barFront = GameObject.Find("Bar Front"); PixelStorage storage = barFront.GetComponent <PixelStorage>(); Assert.False(storage.HasObject("Gold", 1)); Assert.False(storage.HasObject("Silver", 1)); }
public IEnumerator TakesTest1() { yield return(PutTest1()); GameObject.Find("Game Manager").SendMessage("AddGameTask", "player takes 4 'Gold' 'Inn Floor 1 Room 1' 'Bar Front'"); yield return(new WaitForSeconds(10.0f)); GameObject barFront = GameObject.Find("Bar Front"); PixelStorage storage = barFront.GetComponent <PixelStorage>(); Assert.False(storage.HasObject("Gold", 4)); }
public IEnumerator PutTest2() { SceneManager.LoadScene("Game"); yield return(null); GameObject.Find("Game Manager").SendMessage("AddGameTask", "hamen create 4 'Silver'"); yield return(new WaitForSeconds(1.0f)); GameObject.Find("Game Manager").SendMessage("AddGameTask", "hamen puts 4 'Silver' 'Inn Floor 1 Room 1' 'Bar Front'"); yield return(new WaitForSeconds(10.0f)); GameObject barFront = GameObject.Find("Bar Front"); PixelStorage storage = barFront.GetComponent <PixelStorage>(); Assert.True(storage.HasObject("Silver", 4)); }
public void Takes(int number, string item, PixelStorage pixelStorage) { CharacterInventory inv = GetComponentInChildren <CharacterInventory>(); Debug.Assert(inv != null); bool hasItem = pixelStorage.HasObject(item, number); if (!hasItem) { Debug.LogWarning(pixelStorage.name + " does not have " + number + " " + item); return; } Debug.Assert(number >= 1 && number <= 24); for (int i = 0; i < number; ++i) { GameObject obj = pixelStorage.TakeObject(item); if (obj == null) { break; } PixelItem pixelItem = obj.GetComponent <PixelItem>(); Debug.Assert(pixelItem != null); bool succeed = inv.AddItem(pixelItem); if (succeed) { //animator.SetTrigger(Animator.StringToHash("IsPickup")); pixelItem.gameObject.SetActive(false); pixelItem.transform.parent = inv.transform; } } animator.SetTrigger(Animator.StringToHash("IsInteract")); }