コード例 #1
0
ファイル: GameOverScene.cs プロジェクト: dezol/QuickStarters
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D") { ClearFlags = ClearFlags.DepthAndStencil, BackgroundColor = Color.Transparent };
            EntityManager.Add(camera2D);

            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;

            // Animations            
            Duration duration = TimeSpan.FromSeconds(1);          
            this.scaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.opacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);
        }
コード例 #2
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                ClearFlags = ClearFlags.DepthAndStencil, BackgroundColor = Color.Transparent
            };

            EntityManager.Add(camera2D);

            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;

            // Animations
            Duration duration = TimeSpan.FromSeconds(1);

            this.scaleAppear   = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.opacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);
        }
コード例 #3
0
        /// <summary>
        /// Performs further custom initialization for this instance.
        /// </summary>
        /// <remarks>
        /// By default this method does nothing.
        /// </remarks>
        protected override void Initialize()
        {
            base.Initialize();

            this.scene = (GamePlayScene)this.Owner.Scene;
            this.backScene = WaveServices.ScreenContextManager.FindContextByName("BackContext")
                                                              .FindScene<BackgroundScene>();

            this.soundManager = WaveServices.GetService<SoundManager>();

            foreach (var block in this.avaibleBlocks)
            {
                this.Owner.AddChild(block.Entity);
                block.Entity.Enabled = false;
            }

            this.Reset();
        }