Пример #1
0
        public void Start()
        {
            Console.WriteLine("Game.Start");
            string currentSceneName = "None";
            string newSceneName     = "DEFAULT";

            //Task.Factory.StartNew (() => _calendar.Play ());

            while (true)
            {
                _scene              = _sceneFactory.GetScene(newSceneName, currentSceneName);
                currentSceneName    = newSceneName;
                _scene.MessageSent += InvokeSendMessage;
                _calendar.AttachScene(_scene);
                while (true)
                {
                    var outcome = _scene.Play();
                    _scene.MessageSent -= InvokeSendMessage;
                    if (outcome == "Calendar")
                    {
                        _calendar.DetachScene(_scene);
                        currentSceneName = "None";
                        break;
                    }
                    _scene              = _sceneFactory.GetScene(outcome, currentSceneName);
                    _scene.MessageSent += InvokeSendMessage;
                }
            }
        }