Example #1
0
        public void NewGame()
        {
            SceneComponents.Clear();

            Player player = new Player(Game);

            this.SceneComponents.Add(player);

            this.SceneComponents.Add(new PlantManager(Game));
            this.SceneComponents.Add(new FarmPlotManager(Game));

            GoodCollectionBox goodCollectionBox = new GoodCollectionBox(Game);

            this.SceneComponents.Add(goodCollectionBox);

            BadCollectionBox badCollectionBox = new BadCollectionBox(Game);

            this.SceneComponents.Add(badCollectionBox);

            GameplaySceneBackgroundAndMusicManager gameplaySceneManager = new GameplaySceneBackgroundAndMusicManager(Game);

            this.SceneComponents.Add(gameplaySceneManager);

            ScoreManager scoreManager = new ScoreManager(Game);

            this.SceneComponents.Add(scoreManager);

            TimerManager timerManager = new TimerManager(Game);

            this.SceneComponents.Add(timerManager);

            if (firstLoad)
            {
                Game.Services.AddService <Player>(player);
                Game.Services.AddService <ScoreManager>(scoreManager);
                Game.Services.AddService <TimerManager>(timerManager);
                Game.Services.AddService <GoodCollectionBox>(goodCollectionBox);
                Game.Services.AddService <BadCollectionBox>(badCollectionBox);
                Game.Services.AddService <GameplaySceneBackgroundAndMusicManager>(gameplaySceneManager);
            }
            firstLoad = false;
            base.Initialize();
        }
Example #2
0
        private void UpdateEntityInformation_EditorThread(CInspectorSceneComponentViewModel sceneComponentRoot, List <CInspectorEntityComponentViewModel> entityComponents, CInspectorEntityViewModel entity)
        {
            SceneComponents.Clear();
            EntityComponents.Clear();
            EntityInfo.Clear();

            if (sceneComponentRoot != null)
            {
                SceneComponents.Add(sceneComponentRoot);
            }

            if (entityComponents != null)
            {
                EntityComponents = new ObservableCollection <CInspectorEntityComponentViewModel>(entityComponents);
            }

            if (entity != null)
            {
                EntityInfo.Add(entity);
            }
        }