public void ProcessToy(ToyController toy) { if (correctToyTypes.Contains(toy.toyType)) { if (rewardResourceType == ResourceType.Money || rewardResourceType == ResourceType.Both) { moneyTracker.GainMoney(toy.toyType.moneyValue); OnCorrect.Invoke(toy.toyType.moneyValue); } if (rewardResourceType == ResourceType.Approval || rewardResourceType == ResourceType.Both) { approvalTracker.GainApproval(toy.toyType.approvalValue); } } else { if (penaltyResourceType == ResourceType.Money || penaltyResourceType == ResourceType.Both) { moneyTracker.SpendMoney(toy.toyType.moneyValue * toy.toyType.penaltyMultiplier); } if (penaltyResourceType == ResourceType.Approval || penaltyResourceType == ResourceType.Both) { approvalTracker.LoseApproval(toy.toyType.approvalValue * toy.toyType.penaltyMultiplier); } OnIncorrect.Invoke(0.0f); } }
public void ExecuteOption(Event eventInfo, Event.Option option, float?paymentOverride = null, bool notify = true) { if (option.payment != null || paymentOverride.HasValue) { float amount = paymentOverride.HasValue ? Mathf.Abs(paymentOverride.Value) : option.payment.GetAmount(moneyTracker); bool isCharge = paymentOverride.HasValue ? (paymentOverride.Value < 0) : option.payment.isCharge; if (isCharge) { moneyTracker.SpendMoney(amount); if (notify) { OnEventExecuted.Invoke(eventInfo, -amount, timeTracker.currentTime); } } else { moneyTracker.GainMoney(amount); if (notify) { OnEventExecuted.Invoke(eventInfo, amount, timeTracker.currentTime); } } } foreach (Event.CalendarOutcome calendarOutcome in option.eventsToAddToCalendar) { calendar.Add(calendarOutcome); } foreach (Event.PoolOutcome poolOutcome in option.eventsToAddToPool) { pool.Add(poolOutcome); } foreach (Event eventType in option.eventTypesToRemoveFromCalendar) { calendar.RemoveType(eventType); } foreach (Event eventType in option.eventTypesToRemoveFromPool) { pool.RemoveType(eventType); } }