BBGamelib.CCActionManager.addAction C# (CSharp) Method

addAction() public method

public addAction ( CCAction action, System target, bool paused ) : void
action CCAction
target System
paused bool
return void
		public void addAction(CCAction action, System.Object target, bool paused){
			NSUtils.Assert( action != null, "Argument action must be non-nil");
			NSUtils.Assert( target != null, "Argument target must be non-nil");
			
			tHashElement element = _targets.HASH_FIND_INT(target.GetHashCode());
			if (element == null) {
				element = new tHashElement();
				element.paused = paused;
				element.target = target;
				_targets.HASH_ADD_INT(target.GetHashCode(), element);
			}
			actionAllocWithHashElement (element);
			
			NSUtils.Assert (!element.actions.Contains (action), "runAction: Action already running");
			element.actions.Add (action);
			
			action.startWithTarget (target);
		}
		#endregion

Usage Example

        /** Executes an action, and returns the action that is executed.
         * The node becomes the action's target.
         * @warning Starting from v0.8 actions don't retain their target anymore.
         * @since v0.7.1
         * @return An Action pointer
         */
        public CCAction runAction(CCAction action)
        {
            NSUtils.Assert(action != null, "Argument must be non-nil");

            _actionManager.addAction(action, this, !_isRunning);
            return(action);
        }