Beispiel #1
0
    public void InitDay()
    {
        SoundManager.Inst.PlaySound("rooster_crowing.wav");

        WorkManager.Inst.unavailable_workers.Clear();
        WorkManager.Inst.orders.Clear();
        if (Day < 6)
        {
            WorkManager.Inst.generateJobs(Mathf.RoundToInt(Mathf.Lerp(3, 5, Random.value)));
        }
        else
        {
            WorkManager.Inst.orders.Add(new Job(1, "The End! Thanks for playing!", "Haley & Pia & Momin", new List <WorkManager.Profession> {
                WorkManager.Profession.Archictect
            }, new[] { 5 }));
        }

        Chats.Clear();
        // generate chats
        if (Day > 1 && Day < 6)
        {
            var amount       = Mathf.RoundToInt(Random.value * 2 + 2);
            var used_workers = new List <Worker>(10);
            for (int i = 0; i < amount; i++)
            {
                Worker w1 = null;
                switch (Mathf.FloorToInt(Random.value * 10))
                {
                case 0:
                case 1:
                case 2:
                case 3:
                case 4:
                    w1 = WorkManager.Inst.all_workers.RandomWhere(w => !used_workers.Contains(w));
                    used_workers.Add(w1);
                    Chats.Add(DialogueScript.randomSickDayDialogue(w1));
                    WorkManager.Inst.unavailable_workers.Add(w1);
                    break;

                case 5:
                case 6:
                case 7:
                    w1 = WorkManager.Inst.all_workers.RandomWhere(w => !used_workers.Contains(w));
                    used_workers.Add(w1);
                    Chats.Add(DialogueScript.randomVacationDialogue(w1));
                    WorkManager.Inst.unavailable_workers.Add(w1);
                    break;

                case 8:
                case 9:
                    w1 = WorkManager.Inst.all_workers.RandomWhere(w => !used_workers.Contains(w));
                    used_workers.Add(w1);
                    var w2 = WorkManager.Inst.all_workers.RandomWhere(w => !used_workers.Contains(w));
                    Chats.Add(DialogueScript.randomWorkerComplaintDialogue(w1, w2));
                    used_workers.Add(w2);
                    break;
                }
            }
        }

        DefaultButton.OnPointerClick(new PointerEventData(EventSystem.current));
        DefaultButton.Select();

        DayDot.anchoredPosition = DayDot.anchoredPosition.withX(Mathf.Lerp(DayDotPos.x, DayDotPos.y, (Day - 1f) / 4f));
        if (Day > 5)
        {
            DayDot.gameObject.SetActive(false);
            DayButton.SetActive(false);
        }
    }