Inheritance: CCNode
 public static CCScene Scene()
 {
     CCScene scene = new CCScene();
     HelloKeyboardEvent layer = new HelloKeyboardEvent();
     scene.addChild(layer);
     return scene;
 }
 public static CCScene Scene()
 {
     CCScene scene = new CCScene();
     HelloNSNotification layer = new HelloNSNotification();
     scene.addChild(layer);
     return scene;
 }
 public static CCScene Scene()
 {
     CCScene scene = new CCScene();
     HelloEvents layer = new HelloEvents();
     scene.addChild(layer);
     return scene;
 }
 public static CCScene Scene()
 {
     CCScene scene = new CCScene();
     HelloFlash layer = new HelloFlash();
     scene.addChild(layer);
     return scene;
 }
    // Helper class method that creates a Scene with the HelloWorldLayer as the only child.
    public static CCScene Scene()
    {
        // 'scene' is an autorelease object.
        CCScene scene = new CCScene();

        // 'layer' is an autorelease object.
        HelloWorldLayer layer = new HelloWorldLayer();

        // add layer as a child to scene
        scene.addChild(layer);

        // return the scene
        return scene;
    }
		void setNextScene()
		{
			bool runningIsTransition = false;//[_runningScene isKindOfClass:transClass];
			bool newIsTransition = false;//[_nextScene isKindOfClass:transClass];
			
			// If it is not a transition, call onExit/cleanup
			if( ! newIsTransition ) {
				if(_runningScene!=null){
					_runningScene.onExitTransitionDidStart();
					_runningScene.onExit();
					// issue #709. the root node (scene) should receive the cleanup message too
					// otherwise it might be leaked.
					if( _sendCleanupToScene)
						_runningScene.cleanup();
				}
			}
			_runningScene = _nextScene;
			_nextScene = null;
			_runningScene.transform.parent = _view.transform;
			
			if( ! runningIsTransition ) {
				_runningScene.onEnter();
				_runningScene.onEnterTransitionDidFinish();
			}
		}
		public void end()
		{
			_runningScene.onExitTransitionDidStart();
			_runningScene.onExit();
			_runningScene.cleanup();
			
			_runningScene = null;
			_nextScene = null;
			
			// remove all objects, but don't release it.
			// runWithScene might be executed after 'end'.
			_scenesStack.Clear();
			
			this.stopAnimation();

			this.view = null;

			// Purge all managers / caches
			CCAnimationCache.PurgeSharedAnimationCache();
			CCSpriteFrameCache.PurgeSharedSpriteFrameCache();
		}
		public void presentScene(CCScene scene)
		{
			if (_runningScene != null)
				replaceScene (scene);
			else
				runWithScene (scene);
		}
		public void replaceScene(CCScene scene)
		{
			NSUtils.Assert( scene != null, "Argument must be non-nil");
			
			if (_runningScene != null)
			{
				_sendCleanupToScene = true;
				_scenesStack.Pop();
				_scenesStack.Push(scene);
				_nextScene = scene;	// _nextScene is a weak ref
			}
			else
			{
				pushScene (scene);
				startAnimation();
			}
		}
		public void popScene()
		{	
			NSUtils.Assert( _runningScene != null, "A running Scene is needed");
			
			_scenesStack.Pop();
			int c = _scenesStack.Count;
			
			if( c == 0 )
				this.end();
			else {
				_sendCleanupToScene = true;
				_nextScene = _scenesStack.Peek();
				_runningScene.gameObject.SetActive(_runningScene.visible);
			}
		}
		public void pushScene(CCScene scene)
		{
			NSUtils.Assert( scene != null, "Argument must be non-nil");
			
			_sendCleanupToScene = false;
			if (_runningScene != null){
				_runningScene.gameObject.SetActive(false);
			}

			_scenesStack.Push(scene);
			_nextScene = scene;	// _nextScene is a weak ref
		}
		public void runWithScene(CCScene scene)
		{
			NSUtils.Assert( scene != null, "Argument must be non-nil");
			NSUtils.Assert(_runningScene == null, "This command can only be used to start the CCDirector. There is already a scene present.");
			
			pushScene (scene);
			startAnimation();
		}
		protected CCDirector()
		{
			CCDebug.Log("cocos2d: cocos2d-iphone v2.1");
			// scenes
			_runningScene = null;
			_nextScene = null;
			
//			_notificationNode = nil;

			_oldAnimationInterval = _animationInterval = 1.0f / kDefaultFPS;
			_scenesStack = new Stack<CCScene> (10);
			
			// Set default projection (3D)
//			_projection = kCCDirectorProjectionDefault;
			
			// projection delegate if "Custom" projection is used
//			_delegate = nil;
			
			// FPS
			_displayStats = false;

			_displayError = false;

//			_totalFrames = _frames = 0;
			
			// paused ?
			_isPaused = false;
			
			// running thread
//			_runningThread = null;
			
			// scheduler
			_scheduler = new CCScheduler();
			
			// action manager
			_actionManager = new CCActionManager ();
			_scheduler.scheduleUpdate (_actionManager, CCScheduler.kCCPrioritySystem, false);
			
			_winSizeInPixels = Vector2.zero;


			//CCDirectorIOS
//			_ccContentScaleFactor = 1;
//			_isContentScaleSupported = false;
			_touchDispatcher = new CCTouchDispatcher ();
		}