コード例 #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
ファイル: MainMenuScene.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.CreateUI();

            // Animations
            float viewportWidthOverTwo = WaveServices.ViewportManager.VirtualWidth / 2;
            Duration duration = TimeSpan.FromSeconds(1);
            this.superAppear = new SingleAnimation(-viewportWidthOverTwo, viewportWidthOverTwo, duration, EasingFunctions.Back);
            this.squidAppear = new SingleAnimation(WaveServices.ViewportManager.VirtualWidth * 2, viewportWidthOverTwo, duration, EasingFunctions.Back);
            this.playScaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.playOpacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);
        }
コード例 #3
0
ファイル: Game.cs プロジェクト: dezol/QuickStarters
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            // Load storage game data
            GameStorage gameStorage;
            if (WaveServices.Storage.Exists<GameStorage>())
            {
                gameStorage = WaveServices.Storage.Read<GameStorage>();
            }
            else
            {
                gameStorage = new GameStorage();
            }

            Catalog.RegisterItem(gameStorage);

            // Register the SoundManager service
            WaveServices.RegisterService<SoundManager>(new SoundManager());

            // Set portrait orientation in WP
            if (WaveServices.Platform.PlatformType == PlatformType.WindowsPhone)
            {
                application.Adapter.DefaultOrientation = DisplayOrientation.Portrait;
                application.Adapter.SupportedOrientations = DisplayOrientation.Portrait;
            }

            // Use ViewportManager to ensure scaling in all devices
            ViewportManager vm = WaveServices.ViewportManager;
            vm.Activate(768, 1024, ViewportManager.StretchMode.Uniform);

            // Load heavy assets to avoid breaks during gameplay
            this.LoadHeavyAssets();

            var backContext = new ScreenContext("BackContext", new BackgroundScene())
            {
                Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground
            };
            var mainContext = new ScreenContext(new MainMenuScene());
            WaveServices.ScreenContextManager.Push(backContext);      
            WaveServices.ScreenContextManager.Push(mainContext);            
        }