Esempio n. 1
0
        /// <summary>
        /// Changes the routine execution interval on the fly
        /// </summary>
        protected void ChangeRoutineExecutionInterval(string routineName, int newIntervalInMs)
        {
            var routine = FixedUpdateRoutines.FirstOrDefault(r => r.Name == routineName);

            if (routine != null)
            {
                routine.IntervalInMs = newIntervalInMs;
                return;
            }

            routine = UpdateRoutines.FirstOrDefault(r => r.Name == routineName);
            if (routine != null)
            {
                routine.IntervalInMs = newIntervalInMs;
                return;
            }

            routine = LateUpdateRoutines.FirstOrDefault(r => r.Name == routineName);
            if (routine != null)
            {
                routine.IntervalInMs = newIntervalInMs;
                return;
            }

            LunaLog.LogError($"[LMP]: Routine {routineName} not defined");
        }
Esempio n. 2
0
        /// <summary>
        /// Changes the routine execution interval on the fly
        /// </summary>
        protected void ChangeRoutineExecutionInterval(RoutineExecution execution, string routineName, int newIntervalInMs)
        {
            RoutineDefinition routine;

            switch (execution)
            {
            case RoutineExecution.FixedUpdate:
                routine = FixedUpdateRoutines.FirstOrDefault(r => r.Name == routineName);
                break;

            case RoutineExecution.Update:
                routine = UpdateRoutines.FirstOrDefault(r => r.Name == routineName);
                break;

            case RoutineExecution.LateUpdate:
                routine = LateUpdateRoutines.FirstOrDefault(r => r.Name == routineName);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(execution), execution, null);
            }

            if (routine != null)
            {
                routine.IntervalInMs = newIntervalInMs;
            }
            else
            {
                LunaLog.LogError($"[LMP]: Routine {execution}/{routineName} not defined");
            }
        }