Exemplo n.º 1
0
        /// <summary>
        /// Callback for the <see cref = "TimeComponent.WorkingHourTicked">WorkingHourTicked</see> event
        /// of the <see cref = "TimeComponent">TimeComponent</see>.<br/>
        /// Pays the worker's wages.<br/>
        /// Invokes the <see cref = "WagePaid">WagePaid</see> event.
        /// </summary>
        public void OnWorkingHourTicked(object sender, TimeComponent.TimeEventArgs e)
        {
            var totalWage = Employees.Count * WagePerHour;

            this.Log($"Company billed wages {totalWage}");
            WagePaid?.Invoke(this, new WagePaidEventArgs(totalWage));
        }
Exemplo n.º 2
0
        void OnYearTicked(object sender, TimeComponent.TimeEventArgs e)
        {
            foreach (var delayedFavorChange in DelayedFavorChanges)
            {
                delayedFavorChange.Rounds -= 1;

                if (delayedFavorChange.Rounds > 0)
                {
                    continue;
                }
                DecreaseFavor(delayedFavorChange.FavorComponent, delayedFavorChange.Amount);
            }

            DelayedFavorChanges.RemoveAll(delayedFavorChange =>
                                          delayedFavorChange.Rounds <= 0);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Callback for the <see cref = "TimeComponent.YearTicked"/> event.
        /// Bills any outstanding revenues and expenses.
        /// </summary>
        public void OnYearTicked(object sender, TimeComponent.TimeEventArgs e)
        {
            this.Log($"Wealth billing virtual expenses of total {VirtualExpenses}");

            Money          -= VirtualExpenses;
            VirtualExpenses = 0f;

            foreach (var type in Expenses.Keys)
            {
                this.Log($"Wealth billing expenses of {type} for {Expenses[type]}");
            }

            foreach (var type in Revenues.Keys)
            {
                this.Log($"Wealth billing revenues of {type} for {Revenues[type]}");
            }

            Billed?.Invoke(this, new BilledEventArgs(new Dictionary <TurnoverType, float>(Expenses), new Dictionary <TurnoverType, float>(Revenues)));

            Expenses.Clear();
            Revenues.Clear();
        }
Exemplo n.º 4
0
 void OnYearTicked(object sender, TimeComponent.TimeEventArgs e)
 {
     Age += 1;
     AgeChanged?.Invoke(this, new AgeChangedEventArgs(Age));
 }