Пример #1
0
        public override void OneHourPassed()
        {
            //Verringert die Wartezeit, die das Event noch angenommen werden kann, wenn das Event noch nicht angenommen wurde.
            if (motherTaskWaitDuration != 0 && motherEvent != null && !motherEvent.IsEventActive())
            {
                motherTaskWaitDuration = motherTaskWaitDuration - 1;
            }
            //Wenn kein Event vorhanden ist und die Wartezeit bis zum nächsten Event abgelaufen ist, wird eine neues Event erstell und die Wartezeit zum annehmen festgelegt.
            if (timeToNextMotherEvent == 0 && motherEvent == null)
            {
                motherEvent            = new MotherEvent();
                motherTaskWaitDuration = Random.Range(gameManager.GetConfigData().MinMotherWaitDuration,
                                                      gameManager.GetConfigData().MaxMotherWaitDuration);
            }

            //Ist ein Event aktiv und die Dauer des Events auf null, ist das Event erfolgreich beendet und wird entfernt. Der Timer für das nächste Event wird gestartet
            if (motherEvent != null && motherEvent.GetDuration() == 0)
            {
                motherEvent           = null;
                timeToNextMotherEvent = Random.Range(gameManager.GetConfigData().MinMotherWaitDuration,
                                                     gameManager.GetConfigData().MaxMotherWaitDuration);
                GiveKarma(20);
            }

            //Solange das Event aktiv ist, wird es jeden Zyklus benachrichtigt.
            if (motherEvent != null && motherEvent.IsEventActive())
            {
                motherEvent.OneHourPassed();
            }
            //Wenn die Zeit um das Event anzunehmen abgelaufen ist, wird das Event gelöscht und der Spieler bekommt Karma abgezogen.
            if (motherEvent != null && motherTaskWaitDuration == 0)
            {
                motherEvent           = null;
                timeToNextMotherEvent = Random.Range(gameManager.GetConfigData().MinMotherWaitDuration,
                                                     gameManager.GetConfigData().MaxMotherWaitDuration);
                TakeKarma(10);
            }

            if (penalization != 0)
            {
                penalization = penalization - 1;
            }
            //Wenn kein Event vorhanden ist und die Zeit bis zum nächsten Event noch nicht abgelaufen ist, wird sie um 1 verringert.
            if (motherEvent == null && timeToNextMotherEvent != 0)
            {
                timeToNextMotherEvent--;
            }
        }
Пример #2
0
 internal void SetMotherEvent(MotherEvent value)
 {
     motherEvent = value;
 }