Exemple #1
0
        public void Initialize(SpriteBatch batch)
        {
            rainDropsTimer.Start();

            Plant plant = new Plant();
            plant.Position = new Vector2(Game1.graphics.PreferredBackBufferWidth / 8, Game1.graphics.PreferredBackBufferHeight - plant.GetSize().Y);
            plantList.Add(plant);

            Plant plant2 = new Plant();
            plant2.Position = new Vector2(Game1.graphics.PreferredBackBufferWidth * 6    / 8, Game1.graphics.PreferredBackBufferHeight - plant2.GetSize().Y);
            plantList.Add(plant2);

            DeathFactory factory = new DeathFactory(this);
            factory.Position = new Vector2(Game1.graphics.PreferredBackBufferWidth / 2, Game1.graphics.PreferredBackBufferHeight - factory.GetSize().Y);
            deathFactoryList.Add(factory);

            graphicsHandler = new GraphicsHandler();
            graphicsHandler.Initialize(batch);
            oldState = new KeyboardState();

            background = new Sprite();
            background.Initialize();
            background.Texture = Game1.contentManager.Load<Texture2D>(@"Images\Gradient");
            background.Size = new Vector2(Game1.graphics.PreferredBackBufferWidth, Game1.graphics.PreferredBackBufferHeight);
            background.Layer = 0;

            player = new Player(background.Size);

            backgroundSprites.Add(background);

            notCarrie = Game1.contentManager.Load<SoundEffect>(@"Sounds/carrie2");
            notCarrieInstance = notCarrie.CreateInstance();
        }
Exemple #2
0
 public void Draw(GraphicsHandler g)
 {
     g.DrawSprite(FactorySprite);
 }
Exemple #3
0
 public void Draw(GraphicsHandler graphicsHandler)
 {
     graphicsHandler.DrawSprite(plantSprite);
 }
Exemple #4
0
 public void Draw(GraphicsHandler g)
 {
     g.DrawSprite(poisonCloudSprite);
 }
Exemple #5
0
        private void DrawShades(GraphicsHandler g)
        {
            if (shadePositions.Count > 0)
            {
                float alpha = SHADE_TRANSPARENCY;
                Vector2 startPosition = position;

                lock (locker)
                {
                    Color color;

                    foreach (Sprite sprite in spriteDict.Values)
                    {
                        color = new Color(30, 30, 30, 30);
                        sprite.Color = color;
                    }
                    //TODO: Test if reverse order is needed
                    List<Vector2> reversedList = shadePositions.ToList<Vector2>();
                    foreach (Vector2 v in reversedList)
                    {

                        Position = v;
                        foreach (Sprite sprite in spriteDict.Values)
                        {
                            color = sprite.Color;
                            color *= alpha;
                            sprite.Color = color;
                            g.DrawSprite(sprite);
                        }
                    }
                    foreach (Sprite sprite in spriteDict.Values)
                    {
                        sprite.Color = Color.White;
                    }
                    Position = startPosition;
                }
            }
        }
Exemple #6
0
        private void DrawWindPuff(GraphicsHandler g)
        {
            WindPuffMessage puff;
            for (int i = windPuffList.Count - 1; i >= 0; i--)
            {
                puff = windPuffList.ElementAt(i);

                windPuff.Position = puff.Position;
                windPuff.Rotation = puff.Direction;

                g.DrawSprite(windPuff);

                if (puff.checkAge())
                    windPuffList.RemoveAt(i);
            }
        }
Exemple #7
0
 public void DrawSick(GraphicsHandler g)
 {
     Color color = Color.ForestGreen;
     color.A = 128;
     spriteDict[PlayerSprites.Cloud].Color = color;
     g.DrawSprite(spriteDict[PlayerSprites.Cloud]);
     spriteDict[PlayerSprites.Cloud].Color = Color.White;
 }
Exemple #8
0
 public void Draw(GraphicsHandler g)
 {
     lock (locker)
     {
         DrawWindPuff(g);
         DrawShades(g);
         foreach (Sprite sprite in spriteDict.Values)
             g.DrawSprite(sprite);
         if (isSick)
             DrawSick(g);
     }
 }
Exemple #9
0
 public void Draw(GraphicsHandler g)
 {
     g.DrawSprite(FactorySprite);
 }
Exemple #10
0
 public void Draw(GraphicsHandler g)
 {
     g.DrawSprite(poisonCloudSprite);
 }
Exemple #11
0
 public void Draw(GraphicsHandler graphicsHandler)
 {
     graphicsHandler.DrawSprite(plantSprite);
 }