Beispiel #1
0
 public void CancelAction(TimedAction timedAction)
 {
     if (actions.Contains(timedAction))
     {
         actions.Remove(timedAction);
     }
 }
Beispiel #2
0
        public TimedAction ScheduleAction(Action action, float delay, float period)
        {
            TimedAction timedAction = new TimedAction(action, delay, period);

            for (int i = 0; i < actions.Count; i++)
            {
                var act = actions[i];
                if (act.countdown > delay)
                {
                    actions.Insert(i, timedAction);
                    return(timedAction);
                }
            }

            actions.Add(timedAction);
            return(timedAction);
        }