示例#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();
        }
示例#2
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();
        }