Пример #1
0
        /// <summary>
        /// Starts a new game.
        /// </summary>
        /// <param name="content">The content manager to load from.</param>
        private void StartGame(ContentManager content)
        {
            // create the game objects
            _scene = new Scene();
            _scene.LoadContent(content);

            _fishing = new FishingState(this, _scene);
            _fishing.LoadContent(content);

            _ocean = new Ocean(_fishing);
            _ocean.LoadContent(content);

            _money = new Money(_fishing);

            _timer = new Timer(_fishing);

            _store = new Store(_money, _fishing);
            _store.LoadContent(content);
            _store.Hit += OnStoreHit;

            BadgeContext badgeContext = new BadgeContext();

            badgeContext.Fishing = _fishing;
            badgeContext.Money   = _money;
            badgeContext.Store   = _store;
            badgeContext.Timer   = _timer;
            _badges.Context      = badgeContext;

            // create the views
            _sceneView = new SceneView(_scene, _camera);
            _sceneView.LoadContent(content);

            _oceanView = new OceanView(_ocean);

            _fishCaughtView = new FishCaughtView(_fishing);
            _fishEatenView  = new FishEatenView(_fishing);
            _fishingView    = new FishingView(_fishing, _context);
            _fishingView.LoadContent(content);

            _distanceView = new DistanceView(_scene, _fishing);
            _distanceView.LoadContent(content);

            _moneyView = new MoneyView(_money);
            _moneyView.LoadContent(content);

            _timerView = new TimerView(_timer);
            _timerView.LoadContent(content);

            _lureView = new LureView(_fishing, _store);
            _lureView.LoadContent(content);

            _storeView = new StoreView(_store);
            _storeView.LoadContent(content);

            _guideView = new GameGuideView();
            _guideView.LoadContent(content);
            _guide = new GameGuide(_guideView, _fishing, _store, _money);

            _cameraController = new CameraController(_camera, _scene, _fishing);
        }