Exemple #1
0
        /// <summary>
        /// Setups a routine that will be executed. You should normally call this method from the OnEnabled
        /// </summary>
        protected void SetupRoutine(RoutineDefinition routine)
        {
            if (routine == null)
            {
                LunaLog.LogError($"[LMP]: Cannot set a null routine!");
                return;
            }

            if (routine.Execution == RoutineExecution.FixedUpdate && !FixedUpdateRoutines.Any(r => r.Name == routine.Name))
            {
                FixedUpdateRoutines.Add(routine);
            }
            else if (routine.Execution == RoutineExecution.Update && !UpdateRoutines.Any(r => r.Name == routine.Name))
            {
                UpdateRoutines.Add(routine);
            }
            else if (routine.Execution == RoutineExecution.LateUpdate && !LateUpdateRoutines.Any(r => r.Name == routine.Name))
            {
                LateUpdateRoutines.Add(routine);
            }
            else
            {
                LunaLog.LogError($"[LMP]: Routine {routine.Name} already defined");
            }
        }
Exemple #2
0
 /// <summary>
 /// Setups a routine that will be executed. You should normally call this method from the OnEnabled
 /// </summary>
 protected void SetupRoutine(RoutineDefinition routine)
 {
     if (routine.Execution == RoutineExecution.FixedUpdate && !FixedUpdateRoutines.ContainsKey(routine.Name))
     {
         FixedUpdateRoutines.Add(routine.Name, routine);
     }
     else if (routine.Execution == RoutineExecution.Update && !UpdateRoutines.ContainsKey(routine.Name))
     {
         UpdateRoutines.Add(routine.Name, routine);
     }
     else if (routine.Execution == RoutineExecution.LateUpdate && !LateUpdateRoutines.ContainsKey(routine.Name))
     {
         LateUpdateRoutines.Add(routine.Name, routine);
     }
     else
     {
         LunaLog.LogError($"[LMP]: Routine {routine.Name} already defined");
     }
 }