Beispiel #1
0
        override void CreateScene()
        {
            this.Load(WaveContent.Scenes.GameOverScene);
            this.EntityManager.Find("defaultCamera2D").FindComponent <Camera2D>().CenterScreen();

            this.gameStorage = Catalog.GetItem <GameStorage>();
            this.gameScene   = WaveServices.ScreenContextManager.FindContextByName("GamePlay")
                               .FindScene <GamePlayScene>();

            if (this.gameStorage.BestScore < this.gameScene.CurrentScore)
            {
                // Update best score
                this.gameStorage.BestScore = this.gameScene.CurrentScore;

                // Save storage game data
                GameStorage gameStorage = Catalog.GetItem <GameStorage>();
                WaveServices.Storage.Write <GameStorage>(gameStorage);

#if ANDROID
                await WaveServices.GetService <SocialService>().AddNewScore(LeaderboardCode, this.gameScene.CurrentScore);

                await WaveServices.GetService <SocialService>().ShowLeaderboard(LeaderboardCode);
#endif
            }

            this.CreateUI();

            // Music Volume
            WaveServices.MusicPlayer.Volume = 0.2f;
        }
            override void CreateScene()
        {
            this.Load(WaveContent.Scenes.GameOverScene);            
            this.EntityManager.Find("defaultCamera2D").FindComponent<Camera2D>().CenterScreen();

            this.gameStorage = Catalog.GetItem<GameStorage>();
            this.gameScene = WaveServices.ScreenContextManager.FindContextByName("GamePlay")
                                                              .FindScene<GamePlayScene>();

            if (this.gameStorage.BestScore < this.gameScene.CurrentScore)
            {
                // Update best score
                this.gameStorage.BestScore = this.gameScene.CurrentScore;

                // Save storage game data
                GameStorage gameStorage = Catalog.GetItem<GameStorage>();
                WaveServices.Storage.Write<GameStorage>(gameStorage);

#if ANDROID
                await WaveServices.GetService<SocialService>().AddNewScore(LeaderboardCode, this.gameScene.CurrentScore);

                await WaveServices.GetService<SocialService>().ShowLeaderboard(LeaderboardCode);
#endif
            }

            this.CreateUI();

            // Music Volume
            WaveServices.MusicPlayer.Volume = 0.2f;
        }
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.GameOverScene);
            this.EntityManager.Find("defaultCamera2D").FindComponent<Camera2D>().CenterScreen();

            this.gameStorage = Catalog.GetItem<GameStorage>();
            this.gameScene = WaveServices.ScreenContextManager.FindContextByName("GamePlay")
                                                              .FindScene<GamePlayScene>();

            if (this.gameStorage.BestScore < this.gameScene.CurrentScore)
            {
                // Update best score
                this.gameStorage.BestScore = this.gameScene.CurrentScore;

                // Save storage game data
                GameStorage gameStorage = Catalog.GetItem<GameStorage>();
                WaveServices.Storage.Write<GameStorage>(gameStorage);
            }

            this.CreateUI();

            // Music Volume
            WaveServices.MusicPlayer.Volume = 0.2f;
        }