public MenuScreenTest()
            : base("MenuScreenTest")
        {
            MenuEntry one = new MenuEntry("PlayScreen");
            MenuEntry two = new MenuEntry("ModelAndText");
            MenuEntry three = new MenuEntry("ModelScreen");
            MenuEntry four = new MenuEntry("PlayScreen");

            one.Selected += new EventHandler<EventArgs>(one_Selected);
            two.Selected += new EventHandler<EventArgs>(two_Selected);
            three.Selected += new EventHandler<EventArgs>(three_Selected);
            four.Selected += new EventHandler<EventArgs>(four_Selected);

            items = new List<MenuEntry>();
            items.Add(one);
            items.Add(two);
            items.Add(three);
            items.Add(four);

            menuModel = ScreenManager.Game.Content.Load<Model>("MainMenu\\oilBarrel_MainMenu");
            menuTransforms = new Matrix[menuModel.Bones.Count];
            menuModel.CopyAbsoluteBoneTransformsTo(menuTransforms);

            cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));
            cameraManager.SetPosition(new Vector3(0.0f, 0.0f, 500.0f));
            cameraManager.SetLookAtPoint(new Vector3(0.0f, 0.0f, 50.0f));
            //cameraManager.SetPosition(new Vector3(0.0f, 1700.0f, 500.0f));
            //cameraManager.SetLookAtPoint(new Vector3(0.0f, 0.0f, -500.0f));

            menuPosition = new Vector3(100.0f, 0.0f, 0.0f);

            arrows = new Texture2D[2];
            arrows[0] = ScreenManager.Game.Content.Load<Texture2D>("MainMenu\\left_arrow");
            arrows[1] = ScreenManager.Game.Content.Load<Texture2D>("MainMenu\\right_arrow");

            arrow_locations_min = new Vector2[2];
            arrow_locations_max = new Vector2[2];
            arrow_locations_min[0] = new Vector2(550.0f, 320.0f);
            arrow_locations_min[1] = new Vector2(1050.0f, 320.0f);
            arrow_locations_max[0] = new Vector2(530.0f, 320.0f);
            arrow_locations_max[1] = new Vector2(1070.0f, 320.0f);
            selected = 0;
            arrowUpdateTime = 0;
            currentArrowIndex = 0;

            a_button = ScreenManager.Game.Content.Load<Texture2D>("MainMenu\\a_button");
            a_button_position = new Vector2(720.0f, 600.0f);
            font = ScreenManager.Game.Content.Load<SpriteFont>("MainMenu\\font");
            text_position = new Vector2(790.0f, 600.0f);

            tickEffect = ScreenManager.Game.Content.Load<SoundEffect>("Sounds\\Effects\\explosion");
        }
        public ModelScreen()
            : base("Model")
        {
            background = ScreenManager.Game.Content.Load<Texture2D>("Model\\background");
            inputManager = (InputManager)ScreenManager.Game.Services.GetService(typeof(InputManager));
            model = new StaticModel(ScreenManager.Game.Content.Load<Model>("Model\\box"));
            model.Scale = 200.0f;
            modelRotation = 0.0f;

            // Set the position of the camera in world space, for our view matrix.
            cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));
            cameraManager.SetPosition(new Vector3(0.0f, 50.0f, 5000.0f));
        }
        public PlayScreen()
            : base("PlayScreen")
        {
            units = new List<Unit>();
            towers = new List<Tower>();

            Vector2 numTiles = new Vector2(20, 10);

            TileMap.InitializeTileMap(Vector3.Zero, numTiles, new Vector2(100, 100));

            startBase = new TestBase(TileMap.Tiles[0]);
            goalBase = new TestBase(TileMap.Tiles[TileMap.Tiles.Count - 1]);

            startBase.SetGoalBase(goalBase);
            goalBase.SetGoalBase(startBase);

            bases = new List<Base>();
            bases.Add(startBase);
            bases.Add(goalBase);

            TileMap.SetBase(goalBase);
            TileMap.SetBase(startBase);

            TileMap.UpdateTilePaths();

            //towers = new Dictionary<int, Tower>();
            //for (int i = 0; i < numTiles.X * numTiles.Y; i++)
            //   towers.Add(i, new TowerAGood(TileMap.Tiles[i].Position));

            background = ScreenManager.Game.Content.Load<Texture2D>("water_tiled");

            cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));

            myModel = new AnimatedModel(ScreenManager.Game.Content.Load<Model>("AnimatedModel\\dude"));
            myModel.Scale = 2.0f;
            myModel.PlayClip("Take 001");

            currentTile = TileMap.GetTileFromPos(Vector3.Zero);
            myModel.SetPosition(currentTile.Position);

            if (numTiles.X == 10 && numTiles.Y == 10)
            {
                cameraManager.SetPosition(new Vector3(0.0f, 1400.0f, 500.0f));
                cameraManager.SetLookAtPoint(new Vector3(0.0f, 0.0f, 50.0f));
            }
            else if (numTiles.X == 20 && numTiles.Y == 10)
            {
                cameraManager.SetPosition(new Vector3(0.0f, 1700.0f, 500.0f));
                cameraManager.SetLookAtPoint(new Vector3(0.0f, 0.0f, 100.0f));
            }
        }
        public TileTestScreen()
            : base("TileTestScreen")
        {
            units = new List<Unit>();
            towers = new List<Tower>();
            rand = new Random();

            TileMap.InitializeTileMap(Vector3.Zero, new Vector2(10, 10), new Vector2(50, 50));

            startBase = new TestBase(TileMap.Tiles[0]);
            goalBase = new TestBase(TileMap.Tiles[TileMap.Tiles.Count - 1]);

            for (int i = 0; i < TileMap.Tiles.Count; i++)
            {
                TileMap.Tiles[i].UpdatePathTo(goalBase.GetTile());
            }

            background = ScreenManager.Game.Content.Load<Texture2D>("Model\\background");
            myModel = new AnimatedModel(ScreenManager.Game.Content.Load<Model>("AnimatedModel\\dude"));
            myModel.Scale = 5.0f;
            myModel.PlayClip("Take 001");

            currentTile = TileMap.GetTileFromPos(Vector3.Zero);
            myModel.SetPosition(currentTile.Position);
            cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));
            cameraManager.SetPosition(new Vector3(0.0f, 500.0f, 5000.0f));

            ground = new StaticModel(ScreenManager.Game.Content.Load<Model>("Model\\pyramids"));
            ground.Scale = 1000.0f;
            ground.SetPosition(new Vector3(0.0f, -0.1f, 0.0f));

            #region Setup Text
            font = ScreenManager.Game.Content.Load<SpriteFont>("DummyText\\Font");

            center = new Vector2((ScreenManager.GraphicsDeviceManager.PreferredBackBufferWidth / 2),
                                 (ScreenManager.GraphicsDeviceManager.PreferredBackBufferHeight / 2));
            //Setup Text
            text = "Hello World! Hello World! Hellllllooooo World!";

            //Find out how long the text is using this font
            Vector2 textLength = font.MeasureString(text);

            textPosition = new Vector2(center.X - (textLength.X / 2), center.Y - (textLength.Y / 2));
            #endregion
        }
        public override void LoadContent()
        {
            cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));

            numTiles = new Vector2(22, 16);

            SetupCamera();

            background = ScreenManager.Game.Content.Load<Texture2D>("water_tiled");
            background = ScreenManager.Game.Content.Load<Texture2D>("PlayScreen\\oceanWaveBackground");
            playerBackground = ScreenManager.Game.Content.Load<Texture2D>("PlayerMenu\\player_bg");
            playerBackgroundColor = new Color(255, 255, 255, 200);
            playerBackgroundLocation = new Vector2(40.0f, 0.0f);

            font = ScreenManager.Game.Content.Load<SpriteFont>("font");
            dimensions = new Vector2((float)ScreenManager.GraphicsDeviceManager.GraphicsDevice.Viewport.Width,
                                     (float)ScreenManager.GraphicsDeviceManager.GraphicsDevice.Viewport.Height);

            UnitCollection.Initialize(5);
            TowerCollection.Initialize(5);
            BaseCollection.Initialize();
            PlayerCollection.Initialize();
            ProjectileManager.Initialize();
            PowerManager.Initialize();

            if (GameType == PlayerScreenType.Scenario)
            {
                ScenarioManager.Initialize();
            }

            backgroundSong = ScreenManager.Game.Content.Load<Song>("Sounds\\Backgrounds\\multiplayer");

            //TileMap.InitializeTileMap(Vector3.Zero, numTiles, new Vector2(100f, 100f));
            //PlayerCollection.Initialize(playerTypes);

            //FIX THIS!!! assign players their tiles AFTER level manager is loaded...
            //Right now TileMap is being initialized TWICE!!!
            //p1 = new Player(1, 1, 2, TileMap.Tiles[0], PlayerType.Human);
            //aI = new Player(2, 2, 1, TileMap.Tiles[TileMap.Tiles.Count - 1], PlayerType.AI);

            LevelManager.Initialize();
            LevelManager.CreateLevel(numTiles, playerSetup);
            /*LevelManager.AddPlayer(p1);
            LevelManager.AddPlayer(aI);*/
            //LevelManager.LoadLevel(1);

            //Start Thread
            TileMap.pathThread.Start();
            ProjectileManager.particleThread.Start();

            if (MediaPlayer.State == MediaState.Stopped)
            {
                MediaPlayer.Play(backgroundSong);
                MediaPlayer.Volume = 0.1f;
                MediaPlayer.IsRepeating = true;
            }

            videoPlayer = new VideoPlayer();
            video = ScreenManager.Game.Content.Load<Video>("Video\\oceanView");
            if (videoPlayer.State != MediaState.Playing)
            {
                videoPlayer.Play(video);
                videoPlayer.IsLooped = true;
            }

            GC.Collect();//force garbage collection
            isLoaded = true;
        }
Esempio n. 6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            //Setup some basic input
            inputManager = new InputManager();
            inputManager.AddInput(InputAction.Selection, Keys.Enter);
            inputManager.AddInput(InputAction.Selection, Buttons.A);
            inputManager.AddInput(InputAction.Selection, Buttons.Start);

            //Menu Actions
            inputManager.AddInput(InputAction.MenuUp, Keys.Up);
            inputManager.AddInput(InputAction.MenuDown, Keys.Down);
            inputManager.AddInput(InputAction.MenuLeft, Keys.Left);
            inputManager.AddInput(InputAction.MenuRight, Keys.Right);
            inputManager.AddInput(InputAction.MenuSelect, Keys.Enter);
            inputManager.AddInput(InputAction.MenuCancel, Keys.Back);

            inputManager.AddInput(InputAction.MenuUp, Buttons.LeftThumbstickUp);
            inputManager.AddInput(InputAction.MenuDown, Buttons.LeftThumbstickDown);
            inputManager.AddInput(InputAction.MenuLeft, Buttons.LeftThumbstickLeft);
            inputManager.AddInput(InputAction.MenuRight, Buttons.LeftThumbstickRight);
            inputManager.AddInput(InputAction.MenuUp, Buttons.DPadUp);
            inputManager.AddInput(InputAction.MenuDown, Buttons.DPadDown);
            inputManager.AddInput(InputAction.MenuLeft, Buttons.DPadLeft);
            inputManager.AddInput(InputAction.MenuRight, Buttons.DPadRight);
            inputManager.AddInput(InputAction.MenuSelect, Buttons.A);
            inputManager.AddInput(InputAction.MenuCancel, Buttons.B);

            inputManager.AddInput(InputAction.ExitGame, Buttons.Back);
            inputManager.AddInput(InputAction.ExitGame, Keys.Escape);

            this.Services.AddService(typeof(InputManager), inputManager);

            //Movement Actions
            inputManager.AddInput(InputAction.TileMoveUp, Keys.T);
            inputManager.AddInput(InputAction.TileMoveDown, Keys.G);
            inputManager.AddInput(InputAction.TileMoveLeft, Keys.F);
            inputManager.AddInput(InputAction.TileMoveRight, Keys.H);

            inputManager.AddInput(InputAction.TileMoveUp, Buttons.LeftThumbstickUp);
            inputManager.AddInput(InputAction.TileMoveDown, Buttons.LeftThumbstickDown);
            inputManager.AddInput(InputAction.TileMoveLeft, Buttons.LeftThumbstickLeft);
            inputManager.AddInput(InputAction.TileMoveRight, Buttons.LeftThumbstickRight);

            //Tower Action
            inputManager.AddInput(InputAction.TowerBuild, Keys.Space);
            inputManager.AddInput(InputAction.TowerBuild, Buttons.A);
            inputManager.AddInput(InputAction.TowerDestroy, Keys.B);
            inputManager.AddInput(InputAction.TowerDestroy, Buttons.B);
            inputManager.AddInput(InputAction.TowerRepair, Keys.N);
            inputManager.AddInput(InputAction.TowerRepair, Buttons.Y);
            inputManager.AddInput(InputAction.TowerUpgrade, Keys.M);
            inputManager.AddInput(InputAction.TowerUpgrade, Buttons.X);

            //PlayerMenu
            inputManager.AddInput(InputAction.PlayerMenuLeft, Buttons.DPadLeft);
            inputManager.AddInput(InputAction.PlayerMenuRight, Buttons.DPadRight);
            inputManager.AddInput(InputAction.PlayerMenuUp, Buttons.DPadUp);
            inputManager.AddInput(InputAction.PlayerMenuDown, Buttons.DPadDown);
            inputManager.AddInput(InputAction.PlayerMenuLeft, Keys.J);
            inputManager.AddInput(InputAction.PlayerMenuRight, Keys.L);
            inputManager.AddInput(InputAction.PlayerMenuUp, Keys.I);
            inputManager.AddInput(InputAction.PlayerMenuDown, Keys.K);

            //UnitAction
            inputManager.AddInput(InputAction.UnitBuild, Buttons.RightTrigger);
            inputManager.AddInput(InputAction.UnitBuild, Keys.U);
            inputManager.AddInput(InputAction.UnitLeft, Buttons.RightThumbstickLeft);
            inputManager.AddInput(InputAction.UnitRight, Buttons.RightThumbstickRight);
            inputManager.AddInput(InputAction.UnitUp, Buttons.RightThumbstickUp);
            inputManager.AddInput(InputAction.UnitDown, Buttons.RightThumbstickDown);
            inputManager.AddInput(InputAction.UnitLeft, Keys.A);
            inputManager.AddInput(InputAction.UnitRight, Keys.D);
            inputManager.AddInput(InputAction.UnitUp, Keys.W);
            inputManager.AddInput(InputAction.UnitDown, Keys.S);

            //GameLobby
            inputManager.AddInput(InputAction.StartGame, Buttons.X);
            inputManager.AddInput(InputAction.BackToMainMenu, Buttons.Y);
            inputManager.AddInput(InputAction.JoinGame, Buttons.A);
            inputManager.AddInput(InputAction.TeamUp, Buttons.LeftThumbstickUp);
            inputManager.AddInput(InputAction.TeamDown, Buttons.LeftThumbstickDown);
            inputManager.AddInput(InputAction.TeamUp, Buttons.DPadUp);
            inputManager.AddInput(InputAction.TeamUp, Buttons.DPadDown);
            inputManager.AddInput(InputAction.StartGame, Keys.X);
            inputManager.AddInput(InputAction.BackToMainMenu, Keys.Y);
            inputManager.AddInput(InputAction.JoinGame, Keys.A);
            inputManager.AddInput(InputAction.TeamUp, Keys.Up);
            inputManager.AddInput(InputAction.TeamDown, Keys.Down);

            inputManager.AddInput(InputAction.HUD, Buttons.LeftStick);
            inputManager.AddInput(InputAction.HUD, Keys.H);

            inputManager.AddInput(InputAction.PickEnemyTarget, Buttons.LeftShoulder);
            inputManager.AddInput(InputAction.PickEnemyTarget, Keys.Q);

            inputManager.AddInput(InputAction.TowerInformation, Buttons.RightShoulder);
            inputManager.AddInput(InputAction.TowerInformation, Keys.P);

            inputManager.AddInput(InputAction.Pause, Buttons.Start);
            inputManager.AddInput(InputAction.Pause, Keys.Z);

            inputManager.AddInput(InputAction.PowerActivate, Buttons.LeftTrigger);
            inputManager.AddInput(InputAction.PowerActivate, Keys.A);

            //Setup Screen Manager
            screenManager = new ScreenManager(this);
            this.Services.AddService(typeof(ScreenManager), screenManager);

            //Setup Camera
            cameraManager = new CameraManager();
            this.Services.AddService(typeof(CameraManager), cameraManager);

            //Set Starting Screen
            screenManager.ShowScreen(new IntroScreen());
        }
        public static void Initialize(int numPlayers)
        {
            cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));
            NumPlayers = numPlayers;
            towers = new List<List<List<Tower>>>();
            towerCount = new List<List<int>>();
            towerTransforms = new Matrix[MAX_TOWERS];

            for (int i = 0; i < numPlayers; i++)
            {
                towers.Add(new List<List<Tower>>());
                towerCount.Add(new List<int>());

                for (int j = 0; j < towerTypes.Length; j++)
                {
                    towers[i].Add(new List<Tower>());
                    towerCount[i].Add(0);

                    for (int k = 0; k < MAX_TOWERS; k++)
                    {
                        towers[i][j].Add(new Tower((TowerType)j));
                    }
                }
            }

            instancedModels = new List<List<Model>>();
            instancedModelBones = new List<List<Matrix[]>>();
            for (int j = 0; j < towerTypes.Length; j++)
            {
                instancedModelBones.Add(new List<Matrix[]>());
                instancedModels.Add(new List<Model>());
                instancedModels[j].Add(null);
                instancedModelBones[j].Add(null);
                for (int p = 1; p < 5; p++)
                {
                    switch ((TowerType)j)
                    {
                        case TowerType.Plasma:
                            instancedModels[j].Add(ScreenManagement.ScreenManager.Game.Content.Load<Model>("Objects\\Towers\\towerA_" + mapTeamNumToColor[p]));
                            instancedModelBones[j].Add(new Matrix[instancedModels[j][p].Bones.Count]);
                            instancedModels[j][p].CopyAbsoluteBoneTransformsTo(instancedModelBones[j][p]);
                            break;
                        case TowerType.Electric:
                            instancedModels[j].Add(ScreenManagement.ScreenManager.Game.Content.Load<Model>("Objects\\Towers\\towerB_" + mapTeamNumToColor[p]));
                            instancedModelBones[j].Add(new Matrix[instancedModels[j][p].Bones.Count]);
                            instancedModels[j][p].CopyAbsoluteBoneTransformsTo(instancedModelBones[j][p]);
                            break;
                        case TowerType.Cannon:
                            instancedModels[j].Add(ScreenManagement.ScreenManager.Game.Content.Load<Model>("Objects\\Towers\\towerC_" + mapTeamNumToColor[p]));
                            instancedModelBones[j].Add(new Matrix[instancedModels[j][p].Bones.Count]);
                            instancedModels[j][p].CopyAbsoluteBoneTransformsTo(instancedModelBones[j][p]);
                            break;
                        case TowerType.SmallUnit:
                            instancedModels[j].Add(ScreenManagement.ScreenManager.Game.Content.Load<Model>("Objects\\Towers\\baseTowerA"));//+ mapTeamNumToColor[p]));
                            instancedModelBones[j].Add(new Matrix[instancedModels[j][p].Bones.Count]);
                            instancedModels[j][p].CopyAbsoluteBoneTransformsTo(instancedModelBones[j][p]);
                            break;
                        case TowerType.LargeUnit:
                            instancedModels[j].Add(ScreenManagement.ScreenManager.Game.Content.Load<Model>("Objects\\Towers\\baseTowerB"));//+ mapTeamNumToColor[p]));
                            instancedModelBones[j].Add(new Matrix[instancedModels[j][p].Bones.Count]);
                            instancedModels[j][p].CopyAbsoluteBoneTransformsTo(instancedModelBones[j][p]);
                            break;
                    }
                }
            }

            hudBackground = new Texture2D[5];
            hudBackground[1] = ScreenManager.Game.Content.Load<Texture2D>("HUD\\towerStatus1");
            hudBackground[2] = ScreenManager.Game.Content.Load<Texture2D>("HUD\\towerStatus2");
            hudBackground[3] = ScreenManager.Game.Content.Load<Texture2D>("HUD\\towerStatus3");
            hudBackground[4] = ScreenManager.Game.Content.Load<Texture2D>("HUD\\towerStatus4");

            levelFont = ScreenManager.Game.Content.Load<SpriteFont>("HUD\\levelFont");
            hudHealthBar = ScreenManager.Game.Content.Load<Texture2D>("HUD\\towerStatus_Health");
            hudUpgradeBar = new Texture2D[5];
            hudUpgradeBar[1] = ScreenManager.Game.Content.Load<Texture2D>("HUD\\towerStatus_Growth1");
            hudUpgradeBar[2] = ScreenManager.Game.Content.Load<Texture2D>("HUD\\towerStatus_Growth2");
            hudUpgradeBar[3] = ScreenManager.Game.Content.Load<Texture2D>("HUD\\towerStatus_Growth3");
            hudUpgradeBar[4] = ScreenManager.Game.Content.Load<Texture2D>("HUD\\towerStatus_Growth3");
        }
 /// <summary>
 /// Sets up default camera information
 /// </summary>
 protected void SetupCamera()
 {
     cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));
     view = Matrix.CreateTranslation(position) * Matrix.CreateScale(scale) * cameraManager.ViewMatrix;
 }
        public static void Initialize()
        {
            // Construct our particle system components.
            explosionParticles = new ExplosionParticleSystem(ScreenManager.Game, ScreenManager.Game.Content);
            explosionSmokeParticles = new ExplosionSmokeParticleSystem(ScreenManager.Game, ScreenManager.Game.Content);
            projectileTrailParticles = new ProjectileTrailParticleSystem(ScreenManager.Game, ScreenManager.Game.Content);
            smokePlumeParticles = new SmokePlumeParticleSystem(ScreenManager.Game, ScreenManager.Game.Content);
            fireParticles = new FireParticleSystem(ScreenManager.Game, ScreenManager.Game.Content);
            //starParticles = new StarParticleSystem(ScreenManager.Game, ScreenManager.Game.Content);
            upgradeParticles = new ParticleSystem[5];
            repairParticles = new ParticleSystem[5];
            for (int i = 1; i < 5; i++)
            {

                switch(i)
                {
                    case 1:
                        upgradeParticles[i] = new P1Upgrade(ScreenManager.Game, ScreenManager.Game.Content);
                        repairParticles[i] = new P1Upgrade(ScreenManager.Game, ScreenManager.Game.Content);
                        break;
                    case 2:
                        upgradeParticles[i] = new P2Upgrade(ScreenManager.Game, ScreenManager.Game.Content);
                        repairParticles[i] = new P2Upgrade(ScreenManager.Game, ScreenManager.Game.Content);
                        break;
                    case 3:
                        upgradeParticles[i] = new P3Upgrade(ScreenManager.Game, ScreenManager.Game.Content);
                        repairParticles[i] = new P3Upgrade(ScreenManager.Game, ScreenManager.Game.Content);
                        break;
                    case 4:
                        upgradeParticles[i] = new P4Upgrade(ScreenManager.Game, ScreenManager.Game.Content);
                        repairParticles[i] = new P4Upgrade(ScreenManager.Game, ScreenManager.Game.Content);
                        break;

                }

                upgradeParticles[i].DrawOrder = 600;
                repairParticles[i].DrawOrder = 600;
                ScreenManager.Game.Components.Add(upgradeParticles[i]);
                ScreenManager.Game.Components.Add(repairParticles[i]);
            }

            // Set the draw order so the explosions and fire
            // will appear over the top of the smoke.
            smokePlumeParticles.DrawOrder = 100;
            explosionSmokeParticles.DrawOrder = 200;
            projectileTrailParticles.DrawOrder = 300;
            explosionParticles.DrawOrder = 400;
            fireParticles.DrawOrder = 500;
            //starParticles.DrawOrder = 600;

            // Register the particle system components.
            ScreenManager.Game.Components.Add(explosionParticles);
            ScreenManager.Game.Components.Add(explosionSmokeParticles);
            ScreenManager.Game.Components.Add(projectileTrailParticles);
            ScreenManager.Game.Components.Add(smokePlumeParticles);
            ScreenManager.Game.Components.Add(fireParticles);
            //ScreenManager.Game.Components.Add(starParticles);

            projectiles = new List<Projectile>();
            //stars = new List<Star>();

            for (int i = 0; i < MAX_PROJECTILES; i++)
            {
                projectiles.Add(new Projectile(explosionParticles, explosionSmokeParticles, projectileTrailParticles));
                //stars.Add(new Star(starParticles));
            }

            upgradeEffect = new List<List<Upgrade>>();
            upgradeCount = new int[5];
            upgradeEffect.Add(new List<Upgrade>());
            repairEffect = new List<List<Repair>>();
            repairEffect.Add(new List<Repair>());
            repairCount = new int[5];
            for (int p = 1; p < 5; p++)
            {
                upgradeEffect.Add(new List<Upgrade>());
                repairEffect.Add(new List<Repair>());
                for (int i = 0; i < MAX_PROJECTILES; i++)
                {
                    upgradeEffect[p].Add(new Upgrade(upgradeParticles[p]));
                    repairEffect[p].Add(new Repair(repairParticles[p]));
                }
                upgradeCount[p] = 0;
                repairCount[p] = 0;
            }
            projectileCount = 0;

            cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));

            particleThread = new Thread(ThreadedUpdate);
            particleThreadExit = new ManualResetEvent(false);
            timer = System.Diagnostics.Stopwatch.StartNew();
        }
        /// <summary>
        /// Sets up default camera information
        /// </summary>
        protected void SetupCamera()
        {
            cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));
            view = cameraManager.ViewMatrix;

            if (glow == true)
            {
                this.startGlowScale = scale;
                this.endGlowScale = scale - 0.6f;
                this.currentGlowScale = scale;
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Sets up default camera information
 /// </summary>
 protected void SetupCamera()
 {
     cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));
     view = cameraManager.ViewMatrix;
 }
Esempio n. 12
0
        public void SharedSetup(int playerNum, int teamNum, PlayerType type)
        {
            this.PlayerNum = playerNum;
            this.TeamNum = teamNum;
            this.Type = type;

            IsActive = true;
            IsDead = false;

            this.cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager));

            //FIX THIS
            //HealthString = Health.ToString();
            //MoneyString = Money.ToString();

            SetupStatic();
            //SetupNonStatic();

            currentlySelectedPlayerStatus = PlayerMenuTabs.Status;
            if (Type == PlayerType.Human)
                playerMenuBg = ScreenManager.Game.Content.Load<Texture2D>("PlayerMenu\\player0" + playerNum);
            else
                playerMenuBg = ScreenManager.Game.Content.Load<Texture2D>("PlayerMenu\\player0" + playerNum + "computer");

            screenManager = (ScreenManager)ScreenManager.Game.Services.GetService(typeof(ScreenManager));
        }
Esempio n. 13
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            //Setup some basic input
            inputManager = new InputManager();
            inputManager.AddInput(InputAction.Selection, Keys.Enter);
            inputManager.AddInput(InputAction.Rotation, Keys.Space);
            inputManager.AddInput(InputAction.RotateUp, Keys.Up);
            inputManager.AddInput(InputAction.RotateUp, Keys.I);
            inputManager.AddInput(InputAction.RotateDown, Keys.Down);
            inputManager.AddInput(InputAction.RotateLeft, Keys.Left);
            inputManager.AddInput(InputAction.RotateRight, Keys.Right);
            inputManager.AddInput(InputAction.StrafeUp, Keys.W);
            inputManager.AddInput(InputAction.StrafeDown, Keys.S);
            inputManager.AddInput(InputAction.StrafeLeft, Keys.A);
            inputManager.AddInput(InputAction.StrafeRight, Keys.D);

            //Menu Actions
            inputManager.AddInput(InputAction.MenuUp, Keys.Up);
            inputManager.AddInput(InputAction.MenuDown, Keys.Down);
            inputManager.AddInput(InputAction.MenuSelect, Keys.Enter);
            inputManager.AddInput(InputAction.MenuCancel, Keys.Back);
            this.Services.AddService(typeof(InputManager), inputManager);

            //Movement Actions
            inputManager.AddInput(InputAction.TileMoveUp, Keys.T);
            inputManager.AddInput(InputAction.TileMoveDown, Keys.G);
            inputManager.AddInput(InputAction.TileMoveLeft, Keys.F);
            inputManager.AddInput(InputAction.TileMoveRight, Keys.H);

            //Tower Action
            inputManager.AddInput(InputAction.TowerBuild, Keys.Space);

            //Setup Screen Manager
            screenManager = new ScreenManager(this);

            //Setup Camera
            cameraManager = new CameraManager();
            this.Services.AddService(typeof(CameraManager), cameraManager);

            //Set Starting Screen
            screenManager.ShowScreen(new MenuScreenTest());
        }