void EndGame()
        {
            var gameOverScene        = GameOverLayer.SceneWithScore(Window, hitBananas.Count());
            var transitionToGameOver = new CCTransitionMoveInR(0.3f, gameOverScene);

            Director.ReplaceScene(transitionToGameOver);
        }
Esempio n. 2
0
        public GameLayer()
        {
            var touchListener = new CCEventListenerTouchAllAtOnce();

            touchListener.OnTouchesEnded = OnTouchesEnded;

            EventDispatcher.AddEventListener(touchListener, this);
            Color   = new CCColor3B(CCColor4B.White);
            Opacity = 255;

            visibleBananas = new List <CCSprite> ();
            hitBananas     = new List <CCSprite> ();

            monkey          = new CCSprite("Monkey");
            monkey.Position = CCDirector.SharedDirector.WinSize.Center;
            AddChild(monkey);

            Schedule((t) => {
                visibleBananas.Add(AddBanana());
                dt += t;
                if (ShouldEndGame())
                {
                    var gameOverScene = GameOverLayer.SceneWithScore(hitBananas.Count);
                    CCTransitionFadeDown transitionToGameOver = new CCTransitionFadeDown(1.0f, gameOverScene);
                    CCDirector.SharedDirector.ReplaceScene(transitionToGameOver);
                }
            }, 1.0f);

            Schedule((t) => {
                CheckCollision();
            });
        }
Esempio n. 3
0
        public static CCScene SceneWithScore(CCWindow mainWindow, int score)
        {
            var scene = new CCScene(mainWindow);
            var layer = new GameOverLayer(score);

            scene.AddChild(layer);

            return(scene);
        }
        public static CCScene SceneWithScore(int score, int remoteScore)
        {
            var scene = new CCScene();
            var layer = new GameOverLayer(score, remoteScore);

            scene.AddChild(layer);

            return(scene);
        }
Esempio n. 5
0
		public static CCScene SceneWithScore (int score)
		{
			var scene = new CCScene ();
			var layer = new GameOverLayer (score);

			scene.AddChild (layer);

			return scene;
		}
Esempio n. 6
0
        public static CCScene SceneWithScore (CCWindow mainWindow, int score)
        {
            var scene = new CCScene (mainWindow);
            var layer = new GameOverLayer (score);

            scene.AddChild (layer);

            return scene;
        }
Esempio n. 7
0
        void EndGame()
        {
            // Stop scheduled events as we transition to game over scene
            UnscheduleAll();

            var gameOverScene        = GameOverLayer.SceneWithScore(Window, hitBananas.Count);
            var transitionToGameOver = new CCTransitionMoveInR(0.3f, gameOverScene);

            Director.ReplaceScene(transitionToGameOver);
        }
		public static CCScene SceneWithScore (CCWindow mainWindow, int score)
		{
			var scene = new CCScene (mainWindow);

			var winSize = mainWindow.WindowSizeInPixels;
			const float wbase = 640.0f;
			const float hbase = 1136.0f;

			var layer = new GameOverLayer (score, winSize.Width / wbase, winSize.Height / hbase);

			scene.AddChild (layer);

			return scene;
		}
Esempio n. 9
0
        public static CCScene SceneWithScore(CCWindow mainWindow, int score)
        {
            var scene = new CCScene(mainWindow);

            var         winSize = mainWindow.WindowSizeInPixels;
            const float wbase   = 640.0f;
            const float hbase   = 1136.0f;

            var layer = new GameOverLayer(score, winSize.Width / wbase, winSize.Height / hbase);

            scene.AddChild(layer);

            return(scene);
        }
Esempio n. 10
0
        private void beginLocalGame()
        {
            Console.WriteLine("beginLocalGame");
            Schedule((t) => {
                localBananas.Add(AddLocalBanana());
                dt += t;
                if (ShouldEndGame())
                {
                    dt = 0;
                    var gameOverScene = GameOverLayer.SceneWithScore(localHitBananas, remoteHitBananas);
                    CCDirector.SharedDirector.ReplaceScene(gameOverScene);
                    localHitBananas = 0;
                }
            }, 2.0f);

            Schedule((t) => {
                CheckCollision();
            });
        }