public void Request_TakeResourceRequest() { CraftingResources randomCraftingRessource = listCraftingResources[UnityEngine.Random.Range(0, listCraftingResources.Count)]; //Make a request requestShopSystem.MakeChoice(shopAgent, randomCraftingRessource); CraftingResourceRequest requestMade = requestShopSystem.requestSystem.GetAllCraftingRequests()[0]; Assert.NotNull(requestMade, "CraftingResourceRequest empty"); //Take a request adventurerAgent.requestTaker.TakeRequest(requestMade); //Check the taken quest List <CraftingResourceRequest> takenQuests = adventurerAgent.requestTaker.GetItemList(); Assert.AreEqual(1, takenQuests.Count, "The adventurer should have one request"); }
public void Request_CompleteResourceRequest() { CraftingResources randomCraftingRessource = listCraftingResources[UnityEngine.Random.Range(0, listCraftingResources.Count)]; //Make a request requestShopSystem.MakeChoice(shopAgent, randomCraftingRessource); CraftingResourceRequest requestMade = requestShopSystem.requestSystem.GetAllCraftingRequests()[0]; int reward = requestMade.Reward; //Take a request adventurerAgent.requestTaker.TakeRequest(requestMade); //Give the ressource = Complete request adventurerAgent.requestTaker.CheckItemAdd(randomCraftingRessource, 1); //No more requests? Assert.AreEqual(0, requestSystem.GetAllCraftingRequests().Count, "No more requests after giving the resource"); //Reward obtained? Assert.AreEqual(adventurerAgent.wallet.startMoney + reward, adventurerAgent.wallet.Money); //Resource given? Assert.AreEqual(0, adventurerAgent.requestTaker.GetCurrentStock(randomCraftingRessource)); }
/// <summary> /// Manage UI /// </summary> /// <param name="choice">Int associate to a specific UI action</param> /// <param name="resourceRequestToTake">Mandatory if choice = TakeResourceRequest</param> /// <param name="itemToBuy">Mandatory if choice = PurchaseItem</param> public void SetAction(EAdventurerAgentChoices choice, CraftingResourceRequest resourceRequestToTake = null, ShopItemUi?itemToBuy = null) { agentChoice = choice; switch (choice) { case EAdventurerAgentChoices.None: break; case EAdventurerAgentChoices.MainMenu: adventurerInput.ChangeScreen(this, EAdventurerScreen.Main); break; case EAdventurerAgentChoices.ResourceRequest: adventurerInput.ChangeScreen(this, EAdventurerScreen.Request); break; case EAdventurerAgentChoices.Shop: adventurerInput.ChangeScreen(this, EAdventurerScreen.Shop); break; case EAdventurerAgentChoices.Adventure: adventurerInput.ChangeScreen(this, EAdventurerScreen.Adventurer); break; case EAdventurerAgentChoices.TakeResourceRequest: requestTaker.TakeRequest(resourceRequestToTake); break; case EAdventurerAgentChoices.PurchaseItem: AgentShopSubSystem shopCraftingSystem = GameObject.FindObjectOfType <ShopCraftingSystemBehaviour>().system.shopSubSubSystem; shopCraftingSystem.PurchaseItem(itemToBuy.Value.Seller, itemToBuy.Value.Item.itemDetails, this.wallet, this.adventurerInventory.agentInventory); break; case EAdventurerAgentChoices.AdventureForest: adventurerInput.adventurerSystem.system.StartBattle(this, BattleEnvironments.Forest); break; case EAdventurerAgentChoices.AdventureSea: adventurerInput.adventurerSystem.system.StartBattle(this, BattleEnvironments.Sea); break; case EAdventurerAgentChoices.AdventureMountain: adventurerInput.adventurerSystem.system.StartBattle(this, BattleEnvironments.Mountain); break; case EAdventurerAgentChoices.AdventureVolcano: adventurerInput.adventurerSystem.system.StartBattle(this, BattleEnvironments.Volcano); break; case EAdventurerAgentChoices.BattleAttack: adventurerInput.adventurerSystem.system.OnAttackButton(this); break; case EAdventurerAgentChoices.BattleHeal: adventurerInput.adventurerSystem.system.OnHealButton(this); break; case EAdventurerAgentChoices.BattleFlee: adventurerInput.adventurerSystem.system.OnFleeButton(this); break; default: Debug.Log("Wrong EAdventurerAgentChoices : " + choice); break; } }