Exemplo n.º 1
0
        private void ChangePlayerCharacteristics(int interactNum)
        {
            foreach (Impact imp in currentInteractionItem._interactions[interactNum]._impact)
            {
                switch (imp.characteristic)
                {
                case Characteristic.cheerfulness:
                    player.Cheerfulness += imp.value;
                    break;

                case Characteristic.hygiene:
                    player.Hygiene += imp.value;
                    break;

                case Characteristic.intelligence:
                    player.Intelligence += imp.value;
                    break;

                case Characteristic.mood:
                    player.Mood += imp.value;
                    break;

                case Characteristic.satiety:
                    player.Satiety += imp.value;
                    break;

                case Characteristic.money:
                    player.Money += imp.value;
                    break;

                case Characteristic.time:
                    gameTime = gameTime.AddMinutes(imp.value);
                    ShowGameTime();
                    break;

                case Characteristic.getWork:
                    if (player.work.HasJob())
                    {
                        MessageBox.Show("У вас уже есть работа");
                    }
                    else
                    {
                        MessageBox.Show("Поздравляем, теперь у вас есть работа! Рабочее время: пн-пт с 7:00 до 16:30");
                        player.work.Promote();
                    }

                    break;

                case Characteristic.buyFood:
                    if (player.Money >= Products.price[imp.value])
                    {
                        gameLocations[(int)GLocations.kitchen]._interactionItems[1]._interactions.Add
                            (new Interaction("- Употребить " + Products.name[imp.value], new List <Impact> {
                            new Impact(Characteristic.time, 5),
                            new Impact(Characteristic.satiety, Products.satiety[imp.value]),
                            new Impact(Characteristic.eatFood, gameLocations[(int)GLocations.kitchen]._interactionItems[1]._interactions.Count)
                        }));
                        player.Money -= Products.price[imp.value];
                    }
                    else
                    {
                        MessageBox.Show("Недостаточно средств!");
                    }
                    break;

                case Characteristic.eatFood:
                    gameLocations[(int)GLocations.kitchen]._interactionItems[1]._interactions.RemoveAt(imp.value);
                    for (int i = imp.value; i < gameLocations[(int)GLocations.kitchen]._interactionItems[1]._interactions.Count; i++)
                    {
                        gameLocations[(int)GLocations.kitchen]._interactionItems[1]._interactions[i]._impact[2].value -= 1;
                    }

                    currentGameLocation = gameLocations[(int)GLocations.kitchen];
                    FillInteractionLabels();
                    break;

                case Characteristic.schedule:
                    MessageBox.Show("Учебное время: пн, ср, пт с 17:00 до 19:00");
                    break;

                case Characteristic.location:
                    if (imp.value == (int)GLocations.academy && (Study.IsStudyTime(gameTime) == false || Study.IsStudyDay(gameTime.DayOfWeek) == false || player.Money < 250))
                    {
                        if (player.Money < 250)
                        {
                            MessageBox.Show("У вас недостаточно средств для оплаты учебного дня (250 грн)");
                        }
                        else
                        {
                            MessageBox.Show("Сейчас не учебное время. Приходите в пн, ср, пт с 17:00 до 19:00");
                        }
                    }
                    else if (imp.value == (int)GLocations.work && (Work.IsWorkTime(gameTime) == false || Work.IsWorkDay(gameTime.DayOfWeek) == false || !player.work.HasJob()))
                    {
                        if (player.work.HasJob())
                        {
                            MessageBox.Show("Сейчас не рабочее время. Приходите в пн-пт с 6:00 до 8:00");
                        }
                        else
                        {
                            MessageBox.Show("У вас нет работы");
                        }
                    }
                    else
                    {
                        currentGameLocation    = gameLocations[imp.value];
                        currentInteractionItem = null;
                        FillInteractionLabels();
                        ShowLocation();
                    }
                    break;

                case Characteristic.mark:
                    player.GetMark();
                    MessageBox.Show($"Вы получили оценку: {player.study.GetLastMark()}");
                    break;
                }
            }
            ShowPlayerCharacteristics();
        }