public ParticleEditorController(GameWorld gameWorld)
        {
            _gameWorld = gameWorld;
            var scene = new Scene();
            scene.PhysicalWorld = new FarseerPhysicalWorld(Vector2.Zero);
            _gameWorld.AddScene(scene);
            _gameWorld.SetActiveScene(scene);
            _particleEffectActor = scene.AddWorldEntity<ParticleEffectActor>();

            _addParticleEmitterCommand = new AddParticleEmitterCommand(this);
            _setParticleSpawnProcessorCommand = new SetParticleSpawnProcessorCommand(this);
            _setParticleProcessorCommand = new SetParticleProcessorCommand(this);
            _removeParticleProcessorCommand = new RemoveParticleProcessorCommand(this);

            ParticleEffectViewModel = new ObservableCollection<ParticleEffectViewModel>();
            _effectViewModel = new ParticleEffectViewModel("Particle effect", this, _addParticleEmitterCommand);
            ParticleEffectViewModel.Add(_effectViewModel);

            //ToDo: delete these lines in the future
            var bitmap = gameWorld.GraphicsContext.LoadTexture2D("default");
            var asset = new Static2DRenderableAsset();
            asset.Texture2D = bitmap;
            _particleEffectActor.RenderableAsset = asset;
            var name = "one";
            _particleEffectActor.Body = _particleEffectActor.Scene.PhysicalWorld.CreateRectangularBody(160f, 160f, 1f, name);
        }
示例#2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();
            if (OnLoadContent != null)
                OnLoadContent();

            // Create a new SpriteBatch, which can be used to draw textures.
            //spriteBatch = new SpriteBatch(GraphicsDevice);
            Content.RootDirectory = "Content";

            GraphicsContext = new XNAGraphicsContext(this.Graphics, this.Content);
            var bitmap = GraphicsContext.LoadTexture2D("Bitmap1");

            _asset = new Static2DRenderableAsset();
            //_asset.SetBoundingBox(new StoryTimeCore.DataStructures.Rectanglef(0, 0.0f, 720, 1280));
            _asset.Texture2D = bitmap;

            var s = new Scene();

            GraphicsContext.SetCamera(s.Camera);

            s.PhysicalWorld = new FarseerPhysicalWorld(Vector2.Zero);
            _actor = s.AddWorldEntity<Actor>();
            _actor.RenderableAsset = _asset;
            _gameWorld = new GameWorld(GraphicsContext);
            _gameWorld.AddScene(s);
            //rectangle = new Texture2D(GraphicsDevice, 2, 2);
            //rectangle.SetData(new[] { Color.White, Color.Red, Color.Green, Color.Blue });
            // TODO: use this.Content to load your game content here
        }