コード例 #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Texture2D grass = Content.Load <Texture2D>("grass");
            Texture2D path  = Content.Load <Texture2D>("path");

            level.AddTexture(grass);
            level.AddTexture(path);

            enemyTexture[0] = Content.Load <Texture2D>("enemy");
            enemyTexture[1] = Content.Load <Texture2D>("enemy2");

            arial  = Content.Load <SpriteFont>("Arial");
            lucida = Content.Load <SpriteFont>("Lucida");

            Texture2D[] towerTextures = new Texture2D[]
            {
                Content.Load <Texture2D>("Arrow Tower"),
                Content.Load <Texture2D>("Spike Tower")
            };
            Texture2D bulletTexture = Content.Load <Texture2D>("bullet");

            bulletSound = Content.Load <SoundEffect>("gunShot");
            player      = new Player(level, towerTextures, bulletTexture, Content);

            waveManager = new WaveManager(player, level, 30, enemyTexture);

            SpriteFont font = Content.Load <SpriteFont>("Arial");

            Texture2D topBar = Content.Load <Texture2D>("toolbar");

            toolbar = new Toolbar(topBar, font, new Vector2(0, level.Height * 50));
            Texture2D arrowNormal  = Content.Load <Texture2D>("GUI\\Arrow Tower\\arrow normal");
            Texture2D arrowHover   = Content.Load <Texture2D>("GUI\\Arrow Tower\\arrow hover");
            Texture2D arrowPressed = Content.Load <Texture2D>("GUI\\Arrow Tower\\arrow pressed");

            arrowButton          = new Button(arrowNormal, arrowHover, arrowPressed, new Vector2(0, level.Height * 50));
            arrowButton.Clicked += new EventHandler(arrowButton_Clicked);

            Texture2D spikeNormal  = Content.Load <Texture2D>("GUI\\Spike Tower\\spike normal");
            Texture2D spikeHover   = Content.Load <Texture2D>("GUI\\Spike Tower\\spike hover");
            Texture2D spikePressed = Content.Load <Texture2D>("GUI\\Spike Tower\\spike pressed");

            spikeButton          = new Button(spikeNormal, spikeHover, spikePressed, new Vector2(50, level.Height * 50));
            spikeButton.Clicked += new EventHandler(spikeButton_Clicked);

            Texture2D pausetexture = Content.Load <Texture2D>("pause");
            Texture2D playtexture  = Content.Load <Texture2D>("play");

            button1 = new Button1(pausetexture, playtexture, new Vector2(120, level.Height * 50 + 3));
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: krohini1593/BaseDefender
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Texture2D grass = Content.Load<Texture2D>("grass");
            Texture2D path = Content.Load<Texture2D>("path");

            level.AddTexture(grass);
            level.AddTexture(path);

            enemyTexture[0] = Content.Load<Texture2D>("enemy");
            enemyTexture[1]=Content.Load<Texture2D>("enemy2");

            // enemyHealth [0]= ;
            //enemyHealth [1]= ;

            arial = Content.Load<SpriteFont>("Arial");
            lucida = Content.Load<SpriteFont>("Lucida");

            Texture2D towerTexture = Content.Load<Texture2D>("tower");
            Texture2D bulletTexture = Content.Load<Texture2D>("bullet");
            bulletSound = Content.Load<SoundEffect>("gunShot");
            player = new Player(level, towerTexture, bulletTexture,Content);

            // waveManager = new WaveManager(player, level, 30, enemyTexture);
            waveManager = new WaveManager(player, level, 30, enemyTexture, enemyHealth);

            SpriteFont font = Content.Load<SpriteFont>("Arial");

            Texture2D topBar = Content.Load<Texture2D>("toolbar");
            toolbar = new Toolbar(topBar, font, new Vector2(0, level.Height * 32));

            Texture2D arrowNormal = Content.Load<Texture2D>("GUI\\Arrow Tower\\arrow normal");
            Texture2D arrowHover = Content.Load<Texture2D>("GUI\\Arrow Tower\\arrow hover");
            Texture2D arrowPressed = Content.Load<Texture2D>("GUI\\Arrow Tower\\arrow pressed");

            arrowButton = new Button(arrowNormal, arrowHover, arrowPressed, new Vector2(0, level.Height * 32));
            arrowButton.Clicked += new EventHandler(arrowButton_Clicked);

            Texture2D pausetexture = Content.Load<Texture2D>("pause");
            Texture2D playtexture = Content.Load<Texture2D>("play");
            button1=new Button1(pausetexture, playtexture, new Vector2(35, level.Height * 32 + 3));
        }