Example #1
0
 /// <summary>
 /// Method to reset map to a new map
 /// <param name="contentMgr">Content manager</param>
 /// </summary>
 public static void clearMap(ContentManager contentMgr)
 {
     content.Clear();
     contentMgr.Unload();
     skyBoxTexture = null;
     mapRadius     = 200000;
     skyBoxRepeat  = 10;
     skyBoxDrawer  = null;
 }
Example #2
0
 /// <summary>
 /// Method to reset map to a new map
 /// <param name="contentMgr">Content manager</param>
 /// </summary>
 public static void clearMap(ContentManager contentMgr)
 {
     content.Clear();
     contentMgr.Unload();
     skyBoxTexture = null;
     mapRadius = 200000;
     skyBoxRepeat = 10;
     skyBoxDrawer = null;
 }
Example #3
0
        /// <summary>
        /// Sets up the skybox.
        /// </summary>
        /// <param name="gfxDevice">Graphics device instance</param>
        /// <param name="contentMgr">Content manager</param>
        /// <param name="top">top texture name</param>
        /// <param name="bottom">bottom texture name</param>
        /// <param name="left">left texture name</param>
        /// <param name="right">right texture name</param>
        /// <param name="front">front texture name</param>
        /// <param name="back">back texture name</param>
        /// <param name="repeatTop">repeat count for the top texture (normally 1.0f)</param>
        /// <param name="repeatBottom">repeat count for the bottom texture (normally 1.0f)</param>
        /// <param name="repeatLeft">repeat count for the left texture (normally 1.0f)</param>
        /// <param name="repeatRight">repeat count for the right texture (normally 1.0f)</param>
        /// <param name="repeatFront">repeat count for the front texture (normally 1.0f)</param>
        /// <param name="repeatBack">repeat count for the back texture (normally 1.0f)</param>
        public static void SetUpSkyBox(GraphicsDevice gfxDevice, ContentManager contentMgr,
                                       String Text, string Repeat)
        {
            //first check for texture loading errors before setting up the quads:
            if (Text != "" && Text != null)
            {
                skyBoxTexture      = contentMgr.Load <Texture2D>(Text);
                skyBoxTexture.Name = Text;
            }
            float maxAway = mapRadius / 2;

            //top:
            skyBoxRepeat = float.Parse(Repeat);
            if (Text != "" && Text != null)
            {
                skyBoxDrawer = new Graphics.Skybox.Skybox();
                skyBoxDrawer.Initialize(mapRadius / 2, (int)skyBoxRepeat);
                skyBoxDrawer.loadContent(skyBoxTexture, contentMgr, gfxDevice);
            }
        }
Example #4
0
 /// <summary>
 /// Sets up the skybox.
 /// </summary>
 /// <param name="gfxDevice">Graphics device instance</param>
 /// <param name="contentMgr">Content manager</param>
 /// <param name="top">top texture name</param>
 /// <param name="bottom">bottom texture name</param>
 /// <param name="left">left texture name</param>
 /// <param name="right">right texture name</param>
 /// <param name="front">front texture name</param>
 /// <param name="back">back texture name</param>
 /// <param name="repeatTop">repeat count for the top texture (normally 1.0f)</param>
 /// <param name="repeatBottom">repeat count for the bottom texture (normally 1.0f)</param>
 /// <param name="repeatLeft">repeat count for the left texture (normally 1.0f)</param>
 /// <param name="repeatRight">repeat count for the right texture (normally 1.0f)</param>
 /// <param name="repeatFront">repeat count for the front texture (normally 1.0f)</param>
 /// <param name="repeatBack">repeat count for the back texture (normally 1.0f)</param>
 public static void SetUpSkyBox(GraphicsDevice gfxDevice, ContentManager contentMgr,
     String Text, string Repeat)
 {
     //first check for texture loading errors before setting up the quads:
     if (Text != "" && Text != null)
     {
         skyBoxTexture = contentMgr.Load<Texture2D>(Text);
         skyBoxTexture.Name = Text;
     }
     float maxAway = mapRadius / 2;
     //top:
     skyBoxRepeat = float.Parse(Repeat);
     if (Text != "" && Text != null)
     {
         skyBoxDrawer = new Graphics.Skybox.Skybox();
         skyBoxDrawer.Initialize(mapRadius/2, (int)skyBoxRepeat);
         skyBoxDrawer.loadContent(skyBoxTexture, contentMgr, gfxDevice);
     }
 }
Example #5
0
        protected void loadMap2(string mapName)
        {
            // clear all lists
            pathNodes.Clear();
            DynamicObjs.Clear();
            AllObjects.Clear();
            DynamicObjs.Clear();
            Fighters.Clear();
            Destroyers.Clear();
            Towers.Clear();
            Asteroids.Clear();
            Projectiles.Clear();
            spawnPoints.Clear();

            gameGrid = new BBN_Game.Grid.GridStructure(200, 4000);

            SkyBox = new BBN_Game.Graphics.Skybox.Skybox(game, "Skybox/Starfield", 2000, 1);

            Player1 = new BBN_Game.Objects.playerObject(game, BBN_Game.Objects.Team.Red, new Vector3(0,0,-10), Vector3.Zero, false);
            Player2 = new BBN_Game.Objects.playerObject(game, BBN_Game.Objects.Team.Blue, new Vector3(0, 0, +10), Vector3.Zero, false);
            addObject(Player1);
            addObject(Player2);
        }
Example #6
0
        public void loadContent()
        {
            MediaPlayer.IsRepeating = true;

            imperial = game.Content.Load<Song>("Music/Imperial-March");
            beatit = game.Content.Load<Song>("Music/BeatIt");

            laugh1 = game.Content.Load<SoundEffect>("Music/deadLaugh");
            laugh2 = game.Content.Load<SoundEffect>("Music/deadLaugh2");
            explosion = game.Content.Load<SoundEffect>("Music/explosion");

            // laod data if needed etc etc
            if (gameState.Equals(GameState.Playing))
            {
                if (!(prevGameState.Equals(GameState.Playing)))
                {
                    Team1Gold = new List<string>();
                    Team2Gold = new List<string>();

                    MediaPlayer.Play(beatit);

                    //game.Content.Unload();
                    if (SkyBox != null)
                    {
                        SkyBox.Dispose();
                        SkyBox = null;
                    }
                    loadMap(INITIAL_MAP);

                    SkyBox.Initialize();
                    SkyBox.loadContent();
                    sun = new Graphics.SunDrawer(new Vector3(mapRadius + 0.01f, -750, -750),
                                                 new Vector3(mapRadius + 0.01f, 750, -750),
                                                 new Vector3(mapRadius + 0.01f, -750, 750),
                                                 new Vector3(mapRadius + 0.01f, 750, 750), game);
                    prevGameState = GameState.Playing;

                    //Player2.Target = Player1;
                    //Player1.Target = Player2;
                    ObjectsLoaded = true;

                    // hard coded planet placement
                    Random rand = new Random();

                    Objects.Planets.Planet plan = new Objects.Planets.Planet(game, Team.Red, new Vector3(Team1Base.Position.X - rand.Next(500), Team1Base.Position.Y + rand.Next(500), -mapRadius * 1.2f));
                    AllObjects.Add(plan);
                    Objects.Planets.Planet plan2 = new Objects.Planets.Planet(game, Team.Blue, new Vector3(Team2Base.Position.X + rand.Next(500), Team2Base.Position.Y - rand.Next(500), mapRadius * 1.2f));
                    AllObjects.Add(plan2);
                }
            }
            else
            {
                MediaPlayer.Play(imperial);
                ObjectsLoaded = true;
            }
            loadTex = game.Content.Load<Texture2D>("HudTextures/Loading");
            loadNarative = game.Content.Load<Texture2D>("HudTextures/Loading_narrative");
            btnA = game.Content.Load<Texture2D>("Menu/buttonA");
            f = game.Content.Load<SpriteFont>("Fonts/menuFont");

            menuController.loadContent();
        }
Example #7
0
 /// <summary>
 /// Loads skybox subtree of Map tree
 /// </summary>
 /// <param name="reader">XML reader @ skybox</param>
 private void readSkyboxData(XmlReader reader)
 {
     skyboxTexture = reader.GetAttribute("texture");
     skyboxRepeat = Convert.ToSingle(reader.GetAttribute("repeat"));
     // set up skybox
     SkyBox = new BBN_Game.Graphics.Skybox.Skybox(game, skyboxTexture, mapRadius*2, (int)skyboxRepeat);
     game.Components.Add(SkyBox);
 }