Ejemplo n.º 1
0
    private IEnumerator NextDayCountdown()
    {
        while (Application.isPlaying)
        {
            yield return(new WaitForSeconds(weekdayDuration));

            if (isSunday)
            {
                // add beginning of sunday values

                Debug.Log("It's Sunday");
                yield return(new WaitForSeconds(sundayDuration));

                isSunday = false;

                // add end of the sunday values
                sliders.SetBurnoutSlider(sliders.GetBurnoutValue() + burnoutChangeValue);
                sliders.SetMoodSlider(sliders.GetMoodValue() - moodChangeValue);
            }
            else
            {
                // weekday
            }
            GameEvents.instance.NextDayEvent();
        }
    }
Ejemplo n.º 2
0
    private IEnumerator PlayGameLoop()
    {
        while (Application.isPlaying)
        {
            if (isSunday)
            {
                // add beginning of sunday values
                clockText.text = "2:00";

                // idea? code for future: early game we start with small amount of visitors,
                // but late game a lot of visitors.

                // calculate visitor NPC values for today
                // enable members
                spawner.ActivateMembers();

                // this if statement checks if we have more than the visitor cap. if we do, dont add visitors.
                if (addVisitorAmount + visitorCountLastWeek <= maxVisitorAmount)
                {
                    addVisitorAmount += visitorCountLastWeek;
                }
                for (int i = 0; i < addVisitorAmount; i++)
                {
                    GameObject visitor = spawner.GetVisitorNPC();
                    if (visitor == null)
                    {
                        visitor = spawner.PoolMoreNPCs();
                    }
                }
                List <GameObject> newMembers = spawner.CalculateVisitorSunday();
                foreach (GameObject newMember in newMembers)
                {
                    Debug.Log(newMember.name + " has become a Member!");
                    newMember.GetComponent <NPC>().BecomeMember();
                }

                // change member and visitors lists
                // input of 1 is returns visitor list, input of 2 returns member list
                visitorListText.text = spawner.NPCListToString(1);
                memberListText.text  = spawner.NPCListToString(2);

                StartCoroutine(Tithe());

                Debug.Log("It's Sunday");
                yield return(new WaitForSeconds(sundayDuration));

                isSunday = false;

                // add end of the sunday values
                sliders.SetBurnoutSlider(sliders.GetBurnoutValue() + burnoutChangeValue);
                sliders.SetMoodSlider(sliders.GetMoodValue() - moodChangeValue);

                visitorCountLastWeek = addVisitorAmount;
                spawner.DeactivateAll();
                yield return(new WaitForSeconds(1f));
            }
            else
            {
                // weekday
                counter        = 0f;
                clockText.text = "Weekday...";
                clockTime      = clockStart;
                divideNum      = counterAdd;
                yield return(new WaitForSeconds(weekdayDuration));
            }
            GameEvents.instance.NextDayEvent();
        }
    }