示例#1
0
        public void createExplosion()
        {
            mouseState = Mouse.GetState();
            mousePosition = _camera.getLogicalCoords(new Vector2(mouseState.X, mouseState.Y));

            explosion = new Explosion(_explosionTexture, _camera, mousePosition);
            smokeSystem = new SmokeSystem(_smokeTexture, mousePosition);
            splitterSystem = new SplitterSystem(_splitterTexture, mousePosition);
            _fireSound.Play();
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            camera = new Camera(graphics.GraphicsDevice.Viewport);

            Texture2D smokee = Content.Load<Texture2D>("particlesmokee");
            Texture2D spark = Content.Load<Texture2D>("spark");
            Texture2D bangExplosion = Content.Load<Texture2D>("explosion");
            Texture2D masterBall = Content.Load<Texture2D>("master_ball");
            Texture2D masterBallDead = Content.Load<Texture2D>("master_ball_dead2");
            cursorImage = Content.Load<Texture2D>("Pointer");
            SoundEffect explosionSound = Content.Load<SoundEffect>("firesound");

            Vector2 startPosition = new Vector2(0.5f, 0.5f);
            ballSimulation = new BallSimulation();
            explosion = new Explosion(spriteBatch, spark, camera, smokee, bangExplosion, explosionSound, cursorImage, ballSimulation);
            smokeSystem = new SmokeSystem(smokee, startPosition, camera);
            ballview = new BallView(graphics, ballSimulation, Content, masterBall, masterBallDead);
            // TODO: use this.Content to load your game content here
        }