예제 #1
0
        protected override void Update(GameTime gameTime)
        {
            if (currentGameState == GameState.GameStarted)
            {
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                    this.Exit();

                //XnaServer server = new XnaServer();
                //server.Start();

                Vector2 tempDir = new Vector2(screenWidth / 2 - Mouse.GetState().X, screenHeight / 2 - Mouse.GetState().Y);
                tempDir.Normalize();
                thisPlayer.Direction = tempDir;

                tempDir = Vector2.Zero;

                if (stairCounter <= 0)
                {
                    if (!thisPlayer.IsStunned(gameTime.ElapsedGameTime.Milliseconds))
                    {
                        if (Keyboard.GetState().IsKeyDown(Keys.W))
                            tempDir = thisPlayer.Direction;
                        else if (Keyboard.GetState().IsKeyDown(Keys.S))
                            tempDir = -thisPlayer.Direction;
                        else if (Keyboard.GetState().IsKeyDown(Keys.A))
                            tempDir = new Vector2(thisPlayer.Direction.Y, -thisPlayer.Direction.X);
                        else if (Keyboard.GetState().IsKeyDown(Keys.D))
                            tempDir = new Vector2(-thisPlayer.Direction.Y, thisPlayer.Direction.X);
                    }
                    else
                    {
                        tempDir = thisPlayer.InertialVelocity / 5;
                    }

                }
                //if (Keyboard.GetState().IsKeyDown(Keys.W))
                //    tempDir = new Vector2(0, 1);
                //else if (Keyboard.GetState().IsKeyDown(Keys.S))
                //    tempDir = new Vector2(0, -1);
                //else if (Keyboard.GetState().IsKeyDown(Keys.A))
                //    tempDir = new Vector2(1, 0);
                //else if (Keyboard.GetState().IsKeyDown(Keys.D))
                //    tempDir = new Vector2(-1, 0);

                if (thisPlayer.Position.X - tempDir.X * 2 * velocity > 0 && thisPlayer.Position.X - tempDir.X * 2 * velocity < mapBuilder.foregroundContour.GetLength(0) * 20 &&
                    (mapBuilder.foregroundContourWFurniture[(int)(thisPlayer.Position.X - tempDir.X * velocity) / 20, (int)(thisPlayer.Position.Y) / 20] != Color.Black &&
                    mapBuilder.foregroundContourWFurniture[(int)(thisPlayer.Position.X - tempDir.X * 2 * velocity) / 20, (int)(thisPlayer.Position.Y) / 20] != Color.Black || walkThroughWalls))
                    thisPlayer.Position -= new Vector2(tempDir.X * velocity * gameTime.ElapsedGameTime.Milliseconds / 10, 0);

                if (thisPlayer.Position.Y - tempDir.Y * 2 * velocity > 0 && thisPlayer.Position.X - tempDir.X * 2 * velocity < mapBuilder.foregroundContour.GetLength(1) * 20 &&
                    (mapBuilder.foregroundContourWFurniture[(int)(thisPlayer.Position.X) / 20, (int)(thisPlayer.Position.Y - tempDir.Y * velocity) / 20] != Color.Black &&
                    mapBuilder.foregroundContourWFurniture[(int)(thisPlayer.Position.X) / 20, (int)(thisPlayer.Position.Y - tempDir.Y * 2 * velocity) / 20] != Color.Black || walkThroughWalls))
                    thisPlayer.Position -= new Vector2(0, tempDir.Y * velocity * gameTime.ElapsedGameTime.Milliseconds / 10);

                if (thisPlayer.Position.X + thisPlayer.ScreenCenter.X > screenWidth * 0.2 + mapBuilder.gridTexturePlacement.X && mapBuilder.gridTexturePlacement.X < mapBuilder.foregroundContour.GetLength(0) * 20 / 2)
                    mapBuilder.gridTexture = mapBuilder.BuildContourTexture(Math.Max((int)thisPlayer.Position.X - (int)thisPlayer.ScreenCenter.X, 0), Math.Max(0, (int)thisPlayer.Position.Y - (int)thisPlayer.ScreenCenter.Y));

                if (thisPlayer.Position.X + thisPlayer.ScreenCenter.X < -screenWidth * 0.2 + mapBuilder.gridTexturePlacement.X && mapBuilder.gridTexturePlacement.X > 0)
                    mapBuilder.gridTexture = mapBuilder.BuildContourTexture(Math.Max(0, (int)thisPlayer.Position.X - (int)thisPlayer.ScreenCenter.X), Math.Max(0, (int)thisPlayer.Position.Y - (int)thisPlayer.ScreenCenter.Y));

                if (thisPlayer.Position.Y + thisPlayer.ScreenCenter.Y > screenHeight * 0.2 + mapBuilder.gridTexturePlacement.Y && mapBuilder.gridTexturePlacement.Y < mapBuilder.foregroundContour.GetLength(1) * 20 / 2)
                    mapBuilder.gridTexture = mapBuilder.BuildContourTexture(Math.Max((int)thisPlayer.Position.X - (int)thisPlayer.ScreenCenter.X, 0), Math.Max(0, (int)thisPlayer.Position.Y - (int)thisPlayer.ScreenCenter.Y));

                if (thisPlayer.Position.Y + thisPlayer.ScreenCenter.Y < -screenHeight * 0.2 + mapBuilder.gridTexturePlacement.Y && mapBuilder.gridTexturePlacement.Y > 0)
                    mapBuilder.gridTexture = mapBuilder.BuildContourTexture(Math.Max((int)thisPlayer.Position.X - (int)thisPlayer.ScreenCenter.X, 0), Math.Max(0, (int)thisPlayer.Position.Y - (int)thisPlayer.ScreenCenter.Y));

                if (Mouse.GetState().LeftButton == ButtonState.Pressed && thisPlayer.SelectedPrimaryWeapon.CurrentCoolDown <= 0 &&
                    (mapBuilder.Npcs.Count > 0 || players.Count > 0))
                {
                    if (thisPlayer.SelectedPrimaryWeapon.Name != "shotgun")
                    {
                        DetectHit(mapBuilder.Npcs, HitDetected, 0);
                        List<PlayerBase> pb = new List<PlayerBase>();
                        foreach (var p in players.Values)
                            pb.Add(p);

                        DetectHit(pb, HitDetected, 0);

                    }
                    else
                    {
                        DetectHit(mapBuilder.Npcs, HitDetected, .2f);
                        DetectHit(mapBuilder.Npcs, HitDetected, .1f);
                        DetectHit(mapBuilder.Npcs, HitDetected, 0);
                        DetectHit(mapBuilder.Npcs, HitDetected, -.1f);
                        DetectHit(mapBuilder.Npcs, HitDetected, -.2f);
                    }
                }

                mapBuilder.Npcs.RemoveAll(n => n.IsDead);

                if (Keyboard.GetState().IsKeyDown(Keys.D1))
                    thisPlayer.IsPrimaryWeaponActive = true;
                else if (Keyboard.GetState().IsKeyDown(Keys.D2))
                    thisPlayer.IsPrimaryWeaponActive = false;

                if (Mouse.GetState().ScrollWheelValue != previousMouseWheelState)
                {
                    if (Mouse.GetState().ScrollWheelValue > previousMouseWheelState)
                        thisPlayer.NextWeapon();
                    else
                        thisPlayer.PreviousWeapon();

                    previousMouseWheelState = Mouse.GetState().ScrollWheelValue;
                }

                if (thisPlayer.PlayerType == Player.PlayerTypes.human)
                {
                    if (Mouse.GetState().LeftButton == ButtonState.Pressed && thisPlayer.SelectedPrimaryWeapon.Power > 0 && thisPlayer.SelectedPrimaryWeapon.CurrentCoolDown <= 0)
                    {
                        switch (thisPlayer.SelectedPrimaryWeapon.Name)
                        {
                            case "flamethrower":
                                //bombs.Add(new Bomb(Content.Load<Texture2D>("WeaponSprites/bomb"), new AnimatedTexture(Content.Load<Texture2D>("WeaponSprites/explosionsprite"), 5, 5, false, 12, spriteBatch, 50, 50, new Vector2(25, 25), null),
                                //    40, 40, 10, new Vector2(thisPlayer.Position.X + screenWidth / 2 - 25, thisPlayer.Position.Y + screenHeight / 2 - 25) - thisPlayer.Direction * 30, new Vector2(0, 0), 50, 0, 50, true));
                                //bombs.Add(new Bomb(Content.Load<Texture2D>("WeaponSprites/bomb"), new AnimatedTexture(Content.Load<Texture2D>("WeaponSprites/explosionsprite"), 5, 5, false, 12, spriteBatch, 50, 50, new Vector2(25, 25), null),
                                //    80, 80, 10, new Vector2(thisPlayer.Position.X + screenWidth / 2 - 50, thisPlayer.Position.Y + screenHeight / 2 - 50) - thisPlayer.Direction * 50, new Vector2(0, 0), 50, 0, 50, true));
                                //bombs.Add(new Bomb(Content.Load<Texture2D>("WeaponSprites/bomb"), new AnimatedTexture(Content.Load<Texture2D>("WeaponSprites/explosionsprite"), 5, 5, false, 12, spriteBatch, 50, 50, new Vector2(25, 25), null),
                                //    160, 160, 10, new Vector2(thisPlayer.Position.X + screenWidth / 2 - 100, thisPlayer.Position.Y + screenHeight / 2 - 100) - thisPlayer.Direction * 110, new Vector2(0, 0), 50, 0, 50, true));
                                break;
                            default:
                                break;
                        }
                        if (thisPlayer.SelectedPrimaryWeapon.DrainsPower)
                            thisPlayer.SelectedPrimaryWeapon.Power--;
                    }

                    seeThroughWalls = false;
                    walkThroughWalls = false;
                    secondLightSource = false;
                    if (Mouse.GetState().RightButton == ButtonState.Pressed && thisPlayer.SelectedSecondaryWeapon.Power > 0)
                    {
                        switch (thisPlayer.SelectedSecondaryWeapon.Name)
                        {
                            case "grenade":
                                if (thisPlayer.SelectedSecondaryWeapon.CurrentCoolDown <= 0)
                                {
                                    bombs.Add(new Bomb(thisPlayer.SelectedSecondaryWeapon.UserTexture, thisPlayer.SelectedSecondaryWeapon.EffectTexture,
                                    30, 35, 10, new Vector2(thisPlayer.Position.X + screenWidth / 2, thisPlayer.Position.Y + screenHeight / 2),
                                    -thisPlayer.Direction * 6, 50, 500, 500, true, new Vector2(Mouse.GetState().X + thisPlayer.Position.X, Mouse.GetState().Y + thisPlayer.Position.Y)));

                                    serverLayer.SendShoting(thisPlayer, 100, weaponDefinitions, thisPlayer.SelectedSecondaryWeapon, Mouse.GetState().X, Mouse.GetState().Y);
                                }

                                break;
                            case "remotebomb":
                                if (thisPlayer.SelectedSecondaryWeapon.CurrentCoolDown <= 0)
                                {
                                    if (thisPlayer.SelectedSecondaryWeapon.Bomb == null)
                                    {
                                        Bomb bomb = new Bomb(thisPlayer.SelectedSecondaryWeapon.UserTexture, thisPlayer.SelectedSecondaryWeapon.EffectTexture,
                                            30, 35, 10, new Vector2(thisPlayer.Position.X + screenWidth / 2 - 50, thisPlayer.Position.Y + screenHeight / 2 - 50),
                                            Vector2.Zero, 50, 500, 500, false, Vector2.Zero);
                                        thisPlayer.SelectedSecondaryWeapon.Bomb = bomb;
                                        bombs.Add(bomb);

                                        serverLayer.SendShoting(thisPlayer, 100, weaponDefinitions, thisPlayer.SelectedSecondaryWeapon, Mouse.GetState().X, Mouse.GetState().Y);
                                    }
                                    else
                                    {
                                        thisPlayer.SelectedSecondaryWeapon.Bomb.Explode();
                                        thisPlayer.SelectedSecondaryWeapon.Bomb = null;

                                        serverLayer.SendShoting(thisPlayer, 100, weaponDefinitions, thisPlayer.SelectedSecondaryWeapon, Mouse.GetState().X, Mouse.GetState().Y);
                                    }
                                }
                                break;
                            case "timebomb":
                                //bombs.Add(new Bomb(Content.Load<Texture2D>("WeaponSprites/bomb"), new AnimatedTexture(Content.Load<Texture2D>("WeaponSprites/explosionsprite"), 5, 5, false, 12, spriteBatch, 50, 50, new Vector2(25, 25), Content.Load<SoundEffect>("Sounds/ExplosionSound")),
                                //    80, 80, 10, new Vector2(thisPlayer.Position.X + screenWidth / 2, thisPlayer.Position.Y + screenHeight / 2), new Vector2(0, 0), 50, 100, 200, true));
                                break;
                            case "camera":
                                isCameraActive = true;
                                lightPosition2 = new Vector2(thisPlayer.Position.X + screenWidth / 2, thisPlayer.Position.Y + screenHeight / 2);
                                break;
                            case "trap":
                            case "seetraps":
                                break;
                            case "glassfibre": secondLightSource = true;
                                break;
                            case "movefurniture":
                                break;
                            default:
                                break;
                        }
                        thisPlayer.SelectedSecondaryWeapon.Power--;
                    }
                }
                else
                {
                    if (Mouse.GetState().LeftButton == ButtonState.Pressed && thisPlayer.Power > 0)
                    {
                        switch (thisPlayer.SelectedPrimaryWeapon.Name)
                        {
                            case "electricshock":
                            case "push":
                                break;
                            default:
                                break;
                        }
                        if (thisPlayer.SelectedPrimaryWeapon.DrainsPower)
                            thisPlayer.Power--;
                    }

                    seeThroughWalls = false;
                    walkThroughWalls = false;
                    secondLightSource = false;
                    velocity = defaultVelocity;
                    if (Mouse.GetState().RightButton == ButtonState.Pressed && thisPlayer.Power > 0)
                    {
                        switch (thisPlayer.SelectedSecondaryWeapon.Name)
                        {
                            case "seewalls": seeThroughWalls = true;
                                break;
                            case "walkwalls": walkThroughWalls = true;
                                break;
                            case "teleport":
                                if (thisPlayer.SelectedSecondaryWeapon.CurrentCoolDown <= 0)
                                {
                                    thisPlayer.Position += new Vector2(Mouse.GetState().X - screenWidth / 2,Mouse.GetState().Y - screenHeight / 2);
                                    thisPlayer.SelectedSecondaryWeapon.ResetCoolDown();
                                }
                                else
                                {
                                    thisPlayer.SelectedSecondaryWeapon.CurrentCoolDown--;
                                }
                                break;
                            case "wall":
                                mapBuilder.ArtificialWalls.Add(new ArtificialWall { Position = new Vector2(thisPlayer.Position.X + screenWidth / 2, thisPlayer.Position.Y + screenHeight / 2), Texture = artificialWallTexture });
                                break;
                            case "stun":
                            case "becon":
                            case "forcefield":
                                break;
                            case "repel":
                                break;
                            case "speed": velocity = 8;
                                break;
                            case "merge":
                                //foreach (var player in players)
                                    //if ((player.Value.Position - new Vector2(playerX, playerY)).Length() < 10)
                                        //SendMergeRequest(MergeRequestRecieved);
                                break;
                            case "disguise":
                                break;
                            default:
                                break;
                        }
                        thisPlayer.Power--;
                    }
                }

                if (Mouse.GetState().LeftButton == ButtonState.Pressed && thisPlayer.SelectedPrimaryWeapon.CurrentCoolDown <= 0)
                {
                    thisPlayer.SelectedPrimaryWeapon.ResetCoolDown();
                    if (thisPlayer.SelectedPrimaryWeapon.EffectTexture != null)
                        thisPlayer.SelectedPrimaryWeapon.EffectTexture.Start();

                    if (thisPlayer.SelectedPrimaryWeapon.UserTexture != null)
                        thisPlayer.SelectedPrimaryWeapon.UserTexture.Start();
                }

                if (Mouse.GetState().RightButton == ButtonState.Pressed && thisPlayer.SelectedSecondaryWeapon.CurrentCoolDown <= 0)
                {
                    thisPlayer.SelectedSecondaryWeapon.ResetCoolDown();
                    //thisPlayer.SelectedSecondaryWeapon.EffectTexture.Start();
                }

                if (thisPlayer.SelectedPrimaryWeapon.CurrentCoolDown > 0)
                    thisPlayer.SelectedPrimaryWeapon.CurrentCoolDown -= gameTime.ElapsedGameTime.Milliseconds;

                if (thisPlayer.SelectedSecondaryWeapon.CurrentCoolDown > 0)
                    thisPlayer.SelectedSecondaryWeapon.CurrentCoolDown -= gameTime.ElapsedGameTime.Milliseconds;

                bombs.RemoveAll(b => b.Done());

                if (thisPlayer.PlayerType == Player.PlayerTypes.human)
                {
                    Weapon pickedUpWeapon = mapBuilder.weapons.SingleOrDefault(w => w.BoundingBox.Contains((int)thisPlayer.Position.X, (int)thisPlayer.Position.Y));
                    if (pickedUpWeapon != null)
                    {
                        thisPlayer.AddWeapon(pickedUpWeapon);
                        mapBuilder.weapons.RemoveAll(w => w == pickedUpWeapon);
                    }
                }

                Recharger recharger = mapBuilder.Rechargers.SingleOrDefault(r => new Rectangle((int)r.Position.X, (int)r.Position.Y, 40, 40).Contains((int)thisPlayer.Position.Y + screenWidth / 2, (int)thisPlayer.Position.Y + screenHeight / 2));
                if (recharger != null)
                {
                    if (thisPlayer.CarriesWeapon(recharger.Type))
                    {
                        thisPlayer.RechargeWeapon(recharger);
                        mapBuilder.Rechargers.RemoveAll(r => r == recharger);
                    }
                }

                foreach (var bomb in bombs)
                {
                    if (mapBuilder.foregroundContour[(int)(bomb.Position.X) / 20, (int)(bomb.Position.Y) / 20] == Color.Black)
                        bomb.Velocity = new Vector2(-bomb.Velocity.X * .2f * gameTime.ElapsedGameTime.Milliseconds / 1000,
                            -bomb.Velocity.Y * .2f * gameTime.ElapsedGameTime.Milliseconds / 1000);

                    if (bomb.IsExploding)
                    {
                        foreach (var npc in mapBuilder.Npcs)
                        {
                            Vector2 distance = npc.Position - bomb.Position + thisPlayer.ScreenCenter;
                            if (!npc.IsBombImmune(gameTime.ElapsedGameTime.Milliseconds) && distance.Length() < 100)
                            {
                                distance.Normalize();
                                npc.TakeDamage(20, distance, 30);
                            }
                        }

                        Vector2 distance2 = thisPlayer.Position - bomb.Position + thisPlayer.ScreenCenter;
                        if (!thisPlayer.IsBombImmune(gameTime.ElapsedGameTime.Milliseconds) && distance2.Length() < 100)
                        {
                            distance2.Normalize();
                            thisPlayer.TakeDamage(20, -distance2, 30);
                            distance2.Normalize();
                        }
                    }
                }

                foreach (var staircase in mapBuilder.stairs)
                {
                    if (staircase.BoundingBox.Contains((int)(thisPlayer.Position.X + screenWidth / 2), (int)(thisPlayer.Position.Y + screenHeight / 2)))
                    {
                        if (!mapBuilder.standsOnStaircase)
                            stairCounter = 100;

                        mapBuilder.LoadMap(staircase.ToFloor);
                        break;
                    }
                    else
                    {
                        mapBuilder.standsOnStaircase = false;
                    }
                }

                if (stairCounter > 0)
                    stairCounter--;

                //foreach (var npc in mapBuilder.Npcs)
                //    npc.Move(new Vector2(thisPlayer.Position.X, thisPlayer.Position.Y), gameTime.ElapsedGameTime.Milliseconds);

                if (thisPlayer.Life <= 0)
                {
                    thisPlayer.Position = Vector2.Zero;
                    thisPlayer.Life = 2000;
                }

                if (Keyboard.GetState().IsKeyDown(Keys.Space))
                {
                    foreach (var door in mapBuilder.Doors)
                    {
                        if ((door.Position - new Vector2(thisPlayer.Position.X, thisPlayer.Position.Y)).Length() < 50 && !door.IsOpening)
                        {
                            door.IsOpen = !door.IsOpen;
                            mapBuilder.UpdateForegroundContour((int)thisPlayer.Position.X, (int)thisPlayer.Position.Y);
                            break;
                        }
                    }
                }

                mapBuilder.Doors.ForEach(d => d.DecreaseCoolDown(gameTime.ElapsedGameTime.Milliseconds));

                serverLayer.SendPosition(thisPlayer);

                // read messages
                ServerLayer.MessageRouts messageRout;
                while ((messageRout = serverLayer.MessageRout) != ServerLayer.MessageRouts.None)
                {
                    switch (messageRout)
                    {
                        case ServerLayer.MessageRouts.DiscoveryResponse:
                            // just connect to first server discovered
                            serverLayer.Connect();
                            break;
                        case ServerLayer.MessageRouts.Position:
                            serverLayer.GetPosition(players, weaponDefinitions, this, spriteBatch);
                            break;
                        case ServerLayer.MessageRouts.Fire:
                            serverLayer.GetFire(players, weaponDefinitions, thisPlayer, bloodNpc, bloodTexture, bombs);
                            break;
                        case ServerLayer.MessageRouts.MoveNpc:
                            serverLayer.GetNpcPosition(mapBuilder.Npcs);
                            break;
                    }
                }
            }
            else
            {
                currentGameState = startScreen.Update(gameTime.ElapsedGameTime.Milliseconds);
                if (currentGameState == GameState.GameStarted)
                    serverLayer = new ServerLayer();
            }

            base.Update(gameTime);
        }
예제 #2
0
        public void GetFire(Dictionary<Int64, Player> players, List<Weapon> weaponDefinitions, Player thisPlayer, PlayerBase bloodNpc, AnimatedTexture bloodTexture, List<Bomb> bombs)
        {
            long who = msg.ReadInt64();
            Int64 playerId = msg.ReadInt64();
            byte weaponId = msg.ReadByte();
            byte angle = msg.ReadByte();
            int x = msg.ReadInt32();
            int y = msg.ReadInt32();
            Weapon weaponDefinition = weaponDefinitions[weaponId];
            Weapon weapon = players[who].primaryWeapons.SingleOrDefault(w => w.Name == weaponDefinition.Name) ?? players[who].secondaryWeapons.SingleOrDefault(w => w.Name == weaponDefinition.Name);

            if (weapon == null)
            {
                weapon = weaponDefinition.Clone();
                players[who].AddWeapon(weapon);
            }
            players[who].SelectWeapon(weapon);

            if (weapon.IsPrimary)
            {
                if (players[who].SelectedPrimaryWeapon.UserTexture.IsDone)
                    players[who].SelectedPrimaryWeapon.UserTexture.Start();

                if (players[who].SelectedPrimaryWeapon.EffectTexture.IsDone)
                    players[who].SelectedPrimaryWeapon.EffectTexture.Start();

                thisPlayer.TakeDamage(players[who].SelectedPrimaryWeapon.Damage,
                    new Vector2((float)-Math.Sin(((double)angle) / 40), (float)Math.Cos(((double)angle) / 40)),
                    players[who].SelectedPrimaryWeapon.Push);

                thisPlayer.Life -= weapon.Damage;
                thisPlayer.Position = thisPlayer.Position - new Vector2((float)-Math.Sin(((double)angle) / 40), (float)Math.Cos(((double)angle) / 40)) * 50;
                bloodNpc = thisPlayer;
                bloodTexture.Start();
            }
            else
            {
                Vector2 vel = new Vector2(x, y) - thisPlayer.ScreenCenter;
                vel.Normalize();

                vel *= 10;
                if (weapon.Name == "grenade")
                {
                    bombs.Add(new Bomb(players[who].SelectedSecondaryWeapon.UserTexture, players[who].SelectedSecondaryWeapon.EffectTexture,
                                        30, 35, 10, new Vector2(players[who].Position.X + thisPlayer.ScreenCenter.X, players[who].Position.Y + thisPlayer.ScreenCenter.Y),
                                        vel, 500, 500, 100, true, new Vector2(x, y) + players[who].Position));
                }
                else
                {
                    if (players[who].SelectedSecondaryWeapon.Bomb == null)
                    {
                        Bomb bomb = new Bomb(players[who].SelectedSecondaryWeapon.UserTexture, players[who].SelectedSecondaryWeapon.EffectTexture,
                            30, 35, 10, new Vector2(players[who].Position.X + thisPlayer.ScreenCenter.X, players[who].Position.Y + thisPlayer.ScreenCenter.Y),
                            Vector2.Zero, 50, 500, 500, false, Vector2.Zero);
                        players[who].SelectedSecondaryWeapon.Bomb = bomb;
                        bombs.Add(bomb);
                    }
                    else
                    {
                        players[who].SelectedSecondaryWeapon.Bomb.Explode();
                        players[who].SelectedSecondaryWeapon.Bomb = null;
                    }

                }
            }
        }