private void Interact(Vector2 lineOrigin, Vector2 chargePos) { Interactives.Clear(); Bonuses.Clear(); var interactableDetect = Utils.LineCastAll(lineOrigin, chargePos, includeTriggers: true); var interactives = interactableDetect.Where(i => i.transform.CompareTag("Interactive")).ToArray(); foreach (var interactive in interactives) { if (interactive.transform.TryGetComponent(out IActivable activable)) { Interactives.Add(activable); } } var bonuses = interactableDetect.Where(b => b.transform.CompareTag("Bonus")).ToArray(); foreach (var item in bonuses) { if (item.transform.TryGetComponent(out Bonus bonus)) { Bonuses.Add(bonus); } } }
private void RecalculateBonuses() { Bonuses.Clear(); foreach (var inventoryItem in Slots.Values) { inventoryItem?.Bonuses.ForEach(b => Bonuses.Add(b)); } }