Inheritance: FBLibrary.Core.BaseEntities.BaseBomb
コード例 #1
0
ファイル: HostGame.cs プロジェクト: Noxalus/Final-Bomber
        // An evil player wants to plant a bomb
        private void GameServer_BombPlacing(Client sender)
        {
            if (GameServer.Instance.GameManager.GameHasBegun)
            {
                var player = sender.Player;

                if (player.CurrentBombAmount > 0)
                {
                    var bo = GameServer.Instance.GameManager.BombList.Find(b => b.CellPosition == player.CellPosition);

                    if (bo != null) return;

                    var bomb = new Bomb(player.Id, player.CellPosition, player.BombPower, player.BombTimer,
                        player.Speed);

                    bomb.Initialize(GameServer.Instance.GameManager.CurrentMap.Size,
                                    GameServer.Instance.GameManager.CurrentMap.CollisionLayer,
                                    GameServer.Instance.GameManager.HazardMap);

                    GameServer.Instance.GameManager.CurrentMap.Board[bomb.CellPosition.X, bomb.CellPosition.Y] = bomb;
                    GameServer.Instance.GameManager.CurrentMap.CollisionLayer[bomb.CellPosition.X, bomb.CellPosition.Y] = true;

                    GameServer.Instance.GameManager.AddBomb(bomb);
                    player.CurrentBombAmount--;

                    GameServer.Instance.SendPlayerPlacingBomb(sender, bomb.CellPosition);
                }
            }
        }
コード例 #2
0
        // Send to all players that a bomb has blown up
        public void SendBombExploded(Bomb bomb)
        {
            NetOutgoingMessage message = _server.CreateMessage();

            message.Write((byte)MessageType.ServerMessage.BombExploded);
            message.Write(bomb.CellPosition);

            _server.SendToAll(message, NetDeliveryMethod.ReliableOrdered);

            Program.Log.Info("[SEND] Sent that bomb exploded to everyone ! (position: " + bomb.Position + ")");
        }
コード例 #3
0
ファイル: HostGame.cs プロジェクト: Noxalus/Final-Bomber
        private void Bomb_IsExploded(Bomb bomb)
        {
            /*
            //_gameManager.CurrentMap.CalcBombExplosion(bomb);
            GameServer.Instance.SendBombExploded(bomb);
            bomb.Position.Bombed = null;

            //Kollar om bomben exploderar en annan bomb
            if (GameSettings.BombsExplodeBombs)
            {
                foreach (Explosion ex in bomb.Explosion)
                {
                    foreach (Bomb b in GameManager.BombList)
                    {
                        if (b.Position == ex.Position)
                        {
                            if (b.Exploded == false)
                                b.Explode();
                        }
                    }
                }
            }
            */
        }
コード例 #4
0
ファイル: GameManager.cs プロジェクト: Noxalus/Final-Bomber
        private void RemoveBomb(Bomb bomb)
        {
            _bombList.Remove(bomb);

            base.RemoveBomb(bomb);

            Program.Log.Info("Bomb at " + bomb.CellPosition + " has been removed.");
        }
コード例 #5
0
ファイル: GameManager.cs プロジェクト: Noxalus/Final-Bomber
        public void AddBomb(Bomb bomb)
        {
            _bombList.Add(bomb);

            base.AddBomb(bomb);
        }