Beispiel #1
0
        public static void tryCaptureTower(Objects.playerObject player)
        {
            List <Grid.GridObjectInterface> list = GameController.Grid.checkNeighbouringBlocks(player);

            foreach (Grid.GridObjectInterface item in list)
            {
                if (item is Objects.Turret && (item.Position - player.Position).Length() <= MAX_CAPTURE_DISTANCE)
                {
                    Objects.Turret turret = ((Objects.Turret)item);
                    if (turret.Team.Equals(Objects.Team.neutral))
                    {
                        turret.changeTeam(player.Team);
                        GameController.AIController.registerTurretOnTeam(turret, player.Team);
                        if (player.Team == Objects.Team.Red)
                        {
                            Controller.GameController.Team1Gold.Add(TradingInformation.creditsForCapturingTower.ToString());
                            Controller.GameController.team1.teamCredits += TradingInformation.creditsForCapturingTower;
                        }
                        else
                        {
                            Controller.GameController.Team2Gold.Add(TradingInformation.creditsForCapturingTower.ToString());
                            Controller.GameController.team2.teamCredits += TradingInformation.creditsForCapturingTower;
                        }
                        break;
                    }
                }
            }
        }
Beispiel #2
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);
        }
Beispiel #3
0
        /// <summary>
        /// Draws the distance of the object from the player
        /// </summary>
        /// <param name="distance">Distance of the object</param>
        /// <param name="x">X pos of the object</param>
        /// <param name="y">Y pos of the object</param>
        /// <param name="radius">Radius of the object</param>
        /// <param name="col">Colour for the box</param>
        private void drawData(SpriteBatch b, float distance, float x, float y, float radius, Color col, Objects.playerObject player)
        {
            GraphicsDevice.RenderState.DepthBufferEnable      = false;
            GraphicsDevice.RenderState.DepthBufferWriteEnable = false;

            float healthPercent = this.Health / this.totalHealth;

            float heightPercent = ((radius * 2) / (greatestLength / 2)) / 100;

            b.Begin();
            if (this.Equals(player.Target))
            {
                b.Draw(healthBarTex, new Rectangle((int)(x - radius), (int)(y - radius - (25 * heightPercent)), (int)(radius * 2 * healthPercent), (int)(20 * heightPercent)), new Rectangle(0, 0, (int)(healthBarTex.Width * healthPercent), healthBarTex.Height), new Color(1 - (Health / totalHealth), (Health / totalHealth), 0));
            }

            b.DrawString(targetBoxFont, distance.ToString("0000"), new Vector2(x + radius, y + radius), col);
            b.End();

            GraphicsDevice.RenderState.DepthBufferEnable      = true;
            GraphicsDevice.RenderState.DepthBufferWriteEnable = true;
        }
Beispiel #4
0
 /// <summary>
 /// Sets the system to use new instances of player objects
 /// </summary>
 /// <param name="playerIndex">Either Red or Blue</param>
 public static Objects.playerObject spawnPlayer(Objects.Team playerIndex, Game game)
 {
     switch (playerIndex)
     {
         case Objects.Team.Red:
             addObject(Player1 = new BBN_Game.Objects.playerObject(game, Objects.Team.Red, Team1SpawnPoint.Position, new Vector3(0, 0, -1), numPlayers.Equals(Players.single) ? false : true));
             return Player1;
         case Objects.Team.Blue:
             addObject(Player2 = new BBN_Game.Objects.playerObject(game, Objects.Team.Blue, Team2SpawnPoint.Position, new Vector3(0, 0, 1), numPlayers.Equals(Players.single) ? false : true));
             if (numPlayers.Equals(Players.single))
             {
                 Player2.setYawSpeed = Player2.getYawSpeed * YAW_PITCH_ROLL_SPEED_FACTOR_FOR_AI_PLAYER;
                 Player2.setpitchSpeed = Player2.getpitchSpeed * YAW_PITCH_ROLL_SPEED_FACTOR_FOR_AI_PLAYER;
                 Player2.setRollSpeed = Player2.getRollSpeed * YAW_PITCH_ROLL_SPEED_FACTOR_FOR_AI_PLAYER;
             }
             return Player2;
         default:
             throw new Exception("System only supports index 1 or 2");
     }
 }