Esempio n. 1
0
 /// <summary>
 /// WARNING! Adding spans during runtime is not supported since they will not be saved in the database.
 /// This function is only used for testing.
 /// </summary>
 public void CreateTimetableSpanInternal(GameTime pStartTime, GameTime pEndTime, TimetableBehaviour pBehaviour)
 {
     TimetableSpan span = new TimetableSpan() {
         startTime = pStartTime,
         endTime = pEndTime,
         behaviour = pBehaviour
     };
     _timetableSpans.Add(span);
 }
Esempio n. 2
0
        /// <summary>
        /// WARNING! Adding spans during runtime is not supported since they will not be saved in the database.
        /// This function is only used for testing.
        /// </summary>
        public void CreateTimetableSpanInternal(GameTime pStartTime, GameTime pEndTime, TimetableBehaviour pBehaviour)
        {
            TimetableSpan span = new TimetableSpan()
            {
                startTime = pStartTime,
                endTime   = pEndTime,
                behaviour = pBehaviour
            };

            _timetableSpans.Add(span);
        }
Esempio n. 3
0
        private TimetableSpan CreateTimetableSpan(int pStartHour, int pStartMinute, int pEndHour, int pEndMinute, string pName, string[] pTokens)
        {
            GameTime start = new GameTime(pStartHour, pStartMinute);
            GameTime end   = new GameTime(pEndHour, pEndMinute);

            TimetableSpan span = new TimetableSpan();

            span.name      = pName;
            span.startTime = start;
            span.endTime   = end;
            span.behaviour = CreateBehaviourFromTokens(pTokens);

            //Console.WriteLine("Created span: " + span);

            return(span);
        }
Esempio n. 4
0
        public void Update(float dt, GameTime pCurrentTime, Character pCharacter, MimanTingRunner pTingRunner, RoomRunner pRoomRunner, DialogueRunner pDialogueRunner, WorldSettings pWorldSettings)
        {
            TimetableSpan currentSpan = GetCurrentSpan(pCurrentTime);

            if (currentSpan != TimetableSpan.NULL)
            {
                if (pCharacter.isAvatar)
                {
                    return;
                }

                if (pCharacter.lastTimetableSpan != currentSpan)
                {
                    if (pCharacter.lastTimetableSpan != TimetableSpan.NULL)
                    {
                        pCharacter.logger.Log(pCharacter.name + " ended span " + pCharacter.lastTimetableSpan.name);
                        pCharacter.lastTimetableSpan.behaviour.OnFinish(pCharacter, pTingRunner, pRoomRunner, pDialogueRunner);
                    }
                    else
                    {
                        pCharacter.logger.Log(pCharacter.name + " ended span NULL");
                    }
                }
                pCharacter.lastTimetableSpan = currentSpan;

                //pCharacter.logger.Log("Current timetable span to update: " + currentSpan.ToString());
                if (pCharacter.timetableTimer <= 0f)
                {
                    pCharacter.timetableTimer = currentSpan.behaviour.Execute(pCharacter, pTingRunner, pRoomRunner, pDialogueRunner, pWorldSettings);
                    //pCharacter.logger.Log(pCharacter.name + " executed " + currentSpan.behaviour + " and set timetableTimer to " + pCharacter.timetableTimer);
                }
                else
                {
                    pCharacter.timetableTimer -= dt;
                    //pCharacter.logger.Log(pCharacter.name + " timetableTimer = " + pCharacter.timetableTimer);
                }
            }
            else
            {
                D.Log("Found no matching time span in Timetable for character " + pCharacter.name + " at time " + pCurrentTime);
            }
        }
Esempio n. 5
0
        private TimetableSpan CreateTimetableSpan(int pStartHour, int pStartMinute, int pEndHour, int pEndMinute, string pName, string[] pTokens)
        {
            GameTime start = new GameTime(pStartHour, pStartMinute);
            GameTime end = new GameTime(pEndHour, pEndMinute);

            TimetableSpan span = new TimetableSpan();
            span.name = pName;
            span.startTime = start;
            span.endTime = end;
            span.behaviour = CreateBehaviourFromTokens(pTokens);

            //Console.WriteLine("Created span: " + span);

            return span;
        }