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
        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);
        }
Esempio n. 4
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();
            });
        }