BBGamelib.CCScheduler.scheduleBlockForKey C# (CSharp) Method

scheduleBlockForKey() public method

public scheduleBlockForKey ( string key, System owner, float interval, uint repeat, float delay, bool paused, TICK_IMP block ) : void
key string
owner System
interval float
repeat uint
delay float
paused bool
block TICK_IMP
return void
		public void scheduleBlockForKey(string key, System.Object owner, float interval, uint repeat, float delay, bool paused, TICK_IMP block)
		{
			NSUtils.Assert( block != null, "Argument block must be non-nil");
			NSUtils.Assert( owner != null, "Argument owner must be non-nil");
			
			tHashTimerEntry element = hashForTimers.HASH_FIND_INT(owner.GetHashCode());
			
			if (element == null) {
				element = new tHashTimerEntry ();
				element.target = owner;
				hashForTimers.HASH_ADD_INT(owner.GetHashCode(), element);
				
				// Is this the 1st element ? Then set the pause level to all the selectors of this target
				element.paused = paused;
				
			} else
				NSUtils.Assert( element.paused == paused, "CCScheduler. Trying to schedule a block with a pause value different than the target");
			
			
			if (element.timers == null)
				element.timers = new List<CCTimer> (10);
			else
			{
				var enumerator = element.timers.GetEnumerator();
				while (enumerator.MoveNext()) {
					CCTimer timer = enumerator.Current;
					if(timer is CCTimerBlock  && key == ((CCTimerBlock)timer).key) {
						CCDebug.Log("CCScheduler#scheduleBlock. Block already scheduled. Updating interval from: {0:0.0000} to {1:0.0000}", timer.interval, interval);
						timer.interval = interval;
						return;
					}
				}
			}
			
			CCTimerBlock timerBlock = new CCTimerBlock(owner, interval, key, block, repeat, delay);
			element.timers.Add(timerBlock);
		}
		/** Unshedules a selector for a given target.