Beispiel #1
0
    public void EventCalculations(List <KeyValuePair <string, int> > eventEffects)
    {
        foreach (KeyValuePair <string, int> effect in eventEffects)
        {
            switch (effect.Key)
            {
            case "eco":
                ecoSlider.SetValue(ecoSlider.GetValue() + effect.Value);
                break;

            case "money":
                moneySlider.SetValue(moneySlider.GetValue() + effect.Value);
                break;

            case "treeScore":
                foreach (TreeStats tree in trees)
                {
                    tree.Score += effect.Value;
                }
                break;

            case "employeesSalary":
                employees.BaseSalaryChange(effect.Value);
                break;

            case "employeesExtraPayment":
                int payment = 0;
                for (int i = 1; i < employees.GetNumEmployees(); i++)
                {
                    payment += employees.GetSalaryOfEmployee(i);
                }
                moneySlider.SetValue(moneySlider.GetValue() - payment);
                break;

            case "firedEmployee":
                employees.FireEmployee(effect.Value);
                break;

            case "absentEmployee":
                employees.SetRandomEmployeeAsAbsent();
                break;
            }
        }
    }