void EndGame() { var gameOverScene = GameOverLayer.SceneWithScore(Window, hitBananas.Count()); var transitionToGameOver = new CCTransitionMoveInR(0.3f, gameOverScene); Director.ReplaceScene(transitionToGameOver); }
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(); }); }
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); }
public static CCScene SceneWithScore (int score) { var scene = new CCScene (); var layer = new GameOverLayer (score); scene.AddChild (layer); return scene; }
public static CCScene SceneWithScore (CCWindow mainWindow, int score) { var scene = new CCScene (mainWindow); var layer = new GameOverLayer (score); scene.AddChild (layer); return scene; }
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; }
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); }
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(); }); }