private void OnEnable() { Cursor.visible = true; AkSoundEngine.PostEvent("MainMenu_All_Button_Hover", gameObject); if (playerInventory == null) { playerInventory = UIRoot.GetPlayer().GetComponent <InventoryController>(); debrisDropPos = UIRoot.GetPlayer().GetComponentInChildren <SatelliteInventory>().SatelliteSpawnPos; } if (playerInventory.CheckIfItemBucket()) { PopulateItemInventory(); } UpdateAllChunks(); }
public override bool Condition(GameObject target) { foreach (var itemData in Items) { if (!Inventory.CheckIfItemBucket()) { return(false); } if (!Inventory.GetItemBucket()[0].Bucket.ContainsKey(itemData.item)) { return(false); } } //keep track of how many of the objectives arent met int notMet = 0; //index is used to update objective text int index = 0; foreach (var itemData in Items) { var currentAmount = Inventory.GetItemBucket()[0].Bucket[itemData.item]; if (currentAmount < itemData.amount) { notMet++; } string objectiveUpdate = $"{currentAmount}/{itemData.amount} - {actionVerb} {Items[index].item.Name}"; UIRootModule.UIRoot.GetScreen <GameHUD>().objectivePanel.UpdateObjective(index, objectiveUpdate); index++; } if (notMet > 0) { return(false); } //todo update widget ObjectivePopup(isFirstEvent); //Debug.Log("EVENT CONDITION MET"); CodexProgression(); UIRootModule.UIRoot.GetScreen <GameHUD>().objectivePanel.ClearObjectives(); Inventory = null; return(true); }