Exemplo n.º 1
0
 public void Draw(SpriteBatch spriteBatch, Camera camera, Texture2D texture)
 {
     for (int i = 0; i < MAX_SMOKE; i++)
     {
         smokeClouds[i].Draw(spriteBatch, camera, texture);
     }
 }
Exemplo n.º 2
0
 public void Draw(SpriteBatch spriteBatch, Camera camera, Texture2D texture)
 {
     for (int i = 0; i < MAX_PARTICLES; i++)
     {
         particles[i].Draw(spriteBatch, camera, texture);
     }
 }
Exemplo n.º 3
0
        public ExplosionView(SpriteBatch spriteBatch, Texture2D sparkTexture, Texture2D smokeTexture, Camera camera, Vector2 mousePos)
        {
            this.spriteBatch = spriteBatch;
            this.sparkTexture = sparkTexture;
            this.smokeTexture = smokeTexture;
            this.cam = camera;
            smokeSystem = new SmokeSystem(mousePos);
            splitterSystem = new SplitterSystem(mousePos);

            life = maxLifeTime;
        }
Exemplo n.º 4
0
        internal void Draw(SpriteBatch spriteBatch, Camera camera, Texture2D texture)
        {
            Vector2 viewPosition = camera.GetVisualPositions(position);

            Vector2 visualRadius = camera.GetVisualPositions(smokeSize);

            Rectangle rect = new Rectangle((int)viewPosition.X, (int)viewPosition.Y, (int)visualRadius.X, (int)visualRadius.Y);

            Color color = new Color(visibility, visibility, visibility, visibility);

            spriteBatch.Draw(texture, viewPosition, null, color, rotation, new Vector2(origin, origin), size, SpriteEffects.None, 0);
        }
Exemplo n.º 5
0
        internal bool PlayerClicks(Camera cam)
        {
            clickableArea = new Rectangle(0, 0, (int)cam.windowHeight, (int)cam.windowWidth);
            MouseState currentMouseState = Mouse.GetState();
            Point mousePos = new Point(Mouse.GetState().X, Mouse.GetState().Y);

            if (currentMouseState.LeftButton == ButtonState.Pressed
                && clickableArea.Contains(mousePos))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Exemplo n.º 6
0
        internal void Draw(SpriteBatch spriteBatch, Camera camera, Texture2D texture)
        {
            Vector2 viewPosition = camera.GetVisualPositions(position);
            Vector2 visualRadius = camera.GetVisualPositions(radius);

            Rectangle rect = new Rectangle((int)viewPosition.X, (int)viewPosition.Y, (int)visualRadius.X, (int)visualRadius.Y);

            float t = timeLivedSeconds/maxLifeTime;
            if (t > 1.0)
            {
                t = 1.0f;
            }
            float endValue = 0.0f;
            float startValue = 1.0f;
            float visibility = endValue * t + (1.0f - t) * startValue;

            Color color = new Color(visibility, visibility, visibility, visibility);

            spriteBatch.Draw(texture, rect, Color.White);
        }
Exemplo n.º 7
0
 public BallView(SpriteBatch spriteBatch, Texture2D texture, Camera camera)
 {
     this.spriteBatch = spriteBatch;
     this.texture = texture;
     this.camera = camera;
 }
Exemplo n.º 8
0
        /// <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);
            sparkTexture = Content.Load<Texture2D>("spark");
            smokeTexture = Content.Load<Texture2D>("particlesmoke");
            soundEffect = Content.Load<SoundEffect>("fire");
            ballTexture = Content.Load<Texture2D>("ball");
            borderTexture = Content.Load<Texture2D>("border");
            aimTexture = Content.Load<Texture2D>("sikte");

            this.ballSim = new BallSimulation();

            view = new GameView(spriteBatch);
            cam = new View.Camera(graphics.PreferredBackBufferHeight, graphics.PreferredBackBufferWidth);
            soundView = new SoundView(soundEffect);
            ballView = new BallView(spriteBatch, ballTexture,cam);
        }