void FillGoals(List <ItemAmount> filled, out ItemTier[] currentFilled, out bool[] newTiersFilled) { currentFilled = new ItemTier[_goalTiers.Length]; newTiersFilled = new bool[_goalTiers.Length]; for (var i = 0; i < _goalTiers.Length; i++) { var goalTier = _goalTiers[i]; if (goalTier.items.Count == 0) { break; } currentFilled[i] = ItemTier.CopyZero(goalTier); var goalTierItems = goalTier.items; var filledTier = true; // For each tier we need to check if each item is filled for (var j = 0; j < goalTierItems.Count; j++) { var filledItem = FillTier(filled, currentFilled, goalTierItems, j, i); if (!filledItem) { filledTier = false; } } newTiersFilled[i] = filledTier; } }
public static ItemTier[] CopyTiers(ItemTier[] goalTiers) { var newTiers = new ItemTier[goalTiers.Length]; for (var i = 0; i < goalTiers.Length; i++) { newTiers[i] = Copy(goalTiers[i]); } return(newTiers); }
public static ItemTier CopyZero(ItemTier goalTier) { var copy = new ItemTier(); foreach (var itemAmount in goalTier.items) { copy.items.Add(new ItemAmount(itemAmount.type, 0)); } return(copy); }
public static ItemTier CollapseAndCopyItemTiers(List <ItemTier> tieredItems) { var itemTier = new ItemTier(); foreach (var tier in tieredItems) { itemTier.AddItems(Copy(tier).items); } return(itemTier); }
public List <ItemAmount> GetCollapsedGoals() { return(ItemTier.CollapseAndCopyItemTiers(_goalTiers.ToList()).items); }