Example #1
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()
        {
            // Allow transparent background
            this.RenderManager.ClearFlags = ClearFlags.DepthAndStencil;
            this.RenderManager.BackgroundColor = Color.Transparent;

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

            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();

            #if DEBUG
            this.AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PreUpdate);
            #endif
        }
Example #2
0
        protected override void Initialize()
        {
            base.Initialize();
            this.scene = (GameScene)this.Owner.Scene;
            this.soundManager = WaveServices.GetService<SoundManager>();

            this.topMargin = this.transform2D.Rectangle.Height / 2;

            this.SetState(KiteStates.TakeOff);
        }