示例#1
0
        private async void SwitchToScene(GameScene scene)
        {
            if (_currentScene == null)
            {
                _currentScene = scene;
                _currentScene.Enabled = true;
                _currentScene.Visible = true;
                return;
            }

            _currentScene.Visible = true;
            scene.Visible = true;

            _currentScene.Enabled = false;
            scene.Enabled = false;

            _currentScene.Active = false;
            scene.Active = false;

            _currentScene.RunAction(_fadeOut);
            scene.RunAction(_fadeIn);
            await SkidiGame.Camera.RunActionAsync(new MoveTo(MoveToDuration, scene.Position));
            _currentScene = scene;
            _currentScene.Enabled = true;
            _currentScene.Active = true;
        }
示例#2
0
        public override void CreateScenes()
        {
            _mainMenu = new MainMenu(this);
            _currentScene = _mainMenu;
            _playScene = new PlayScene(this);

            GameLayer.Add(_mainMenu);
            GameLayer.Add(_playScene);
        }