static void RegisterAnIncomeSourceFromJob(EventInfo info) { JobRegisterInfo job = (JobRegisterInfo)info; incomeSources().Add(job.job); TaxationSystem.getIncomeafterMandatoryPayments(getAllIncomeSourceGrossTotals(12)); OnNewIncome.Invoke(); }
static void registerExtraIncome(EventInfo info) { ExtraIncomeInfo extra = (ExtraIncomeInfo)info; IncomeSource incomeSource = new IncomeSource(extra.extraIncomeAmount, true); incomeSources().Add(incomeSource); TaxationSystem.getIncomeafterMandatoryPayments(getAllIncomeSourceGrossTotals(12)); OnNewIncome.Invoke(); }
//Delegatesta ja eventistä. Näillä kukkaro saa lähetettyä rahanmuutoksesta viestin kaikille onincreasen tilanneille //classeille viestin siitä, että rahatilanne on muuttunut, delegaten ja eventin avulla näitä tilaajia ei tarvitse //erikseen unityn editorissä määritellä, eli toisinsanoen pelaajan kukkaron ei tarvitse tietää, kenelle tätä viestiä lähetetään. static PlayerEconomy() { GameEventSystem.RegisterListener(Event_Type.FLOAT_CHANGE, SetMoney); GameEventSystem.RegisterListener(Event_Type.JOB_REGISTERED_TO_PLAYER, RegisterAnIncomeSourceFromJob); GameEventSystem.RegisterListener(Event_Type.EXTRA_INCOME, registerExtraIncome); TaxationSystem.getIncomeafterMandatoryPayments(getAllIncomeSourceGrossTotals(12)); DateTimeSystem.OnMonthChange += PayFromIncomeSources; DateTimeSystem.OnMonthChange += deductExpenses; }