コード例 #1
0
        /// <summary>
        /// Creates the UI elements and add them to the EntityManager.
        /// </summary>
        private void CreateUI()
        {
            var currentScore = EntitiesFactory.CreateCurrentScore(275, (int)this.VirtualScreenManager.VirtualWidth);

            currentScore.Text = this.finalScore.ToString();
            this.EntityManager.Add(currentScore);

            var bestScoreText = EntitiesFactory.CreateBestScore(395, this.gameStorage.BestScore);

            this.EntityManager.Add(bestScoreText);

            var button = EntitiesFactory.CreatePlayButton(423, 451);

            this.EntityManager.Add(button);

            button.Click += (o, e) =>
            {
                var screenTransition = new CoverTransition(TimeSpan.FromSeconds(0.25), CoverTransition.EffectOptions.FromBotton)
                {
                    EaseFunction = new CubicEase()
                    {
                        EasingMode = EasingMode.EaseInOut
                    }
                };

                WaveServices.ScreenContextManager.Pop(screenTransition);
            };
        }
コード例 #2
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            Entity camera = new Entity()
                            .AddComponent(new Camera2D());

            EntityManager.Add(camera);

            this.RenderManager.RegisterLayerAfter(new ObstaclesLayer(this.RenderManager), DefaultLayers.Alpha);

            // Game Entities
            this.CreateBackground();
            this.CreateKite();
            this.CreateObstacles();

            this.crashEffect = EntitiesFactory.CreateCrashEffect();
            this.EntityManager.Add(this.crashEffect);

            // UI
            this.currentScoreTB = EntitiesFactory.CreateCurrentScore(40);
            this.EntityManager.Add(this.currentScoreTB);

#if DEBUG
            this.AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PreUpdate);
#endif
        }
コード例 #3
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.GameScene);

            // UI
            var currentScoreTB = EntitiesFactory.CreateCurrentScore(40, (int)this.VirtualScreenManager.VirtualWidth);

            this.EntityManager.Add(currentScoreTB);

#if DEBUG
            this.AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PreUpdate);
#endif
        }
コード例 #4
0
        /// <summary>
        /// Creates the UI elements and add them to the EntityManager.
        /// </summary>
        private void CreateUI()
        {
            var gameOver = EntitiesFactory.CreateGameOverText();

            this.EntityManager.Add(gameOver);

            var currentScore = EntitiesFactory.CreateCurrentScore(275);

            currentScore.Text = this.gameScene.CurrentScore.ToString();
            this.EntityManager.Add(currentScore);

            var bestScoreText = EntitiesFactory.CreateBestScore(395, this.gameStorage.BestScore);

            this.EntityManager.Add(bestScoreText);

            var button = EntitiesFactory.CreatePlayButton(423, 451);

            this.EntityManager.Add(button);

            button.Click += (o, e) =>
            {
                var screenTransition = new CoverTransition(TimeSpan.FromSeconds(0.25), CoverTransition.EffectOptions.FromBotton)
                {
                    EaseFunction = new CubicEase()
                    {
                        EasingMode = EasingMode.EaseInOut
                    }
                };

                WaveServices.ScreenContextManager.Pop(screenTransition);

                this.gameScene.SetState(GameScene.GameSceneStates.Gameplay);
                this.gameScene.Resume();
            };

            var background = EntitiesFactory.CreateGameOverBackground();

            this.EntityManager.Add(background);
        }