protected virtual void DestroyBomb(BaseBomb baseBomb) { if (baseBomb != null) { // We don't forget to give it back to its owner if (baseBomb.PlayerId >= 0) { BasePlayer player = _basePlayerList.Find(p => p.Id == baseBomb.PlayerId); if (player != null && player.CurrentBombAmount < player.TotalBombAmount) player.CurrentBombAmount++; } baseBomb.Destroy(); } }
protected virtual void RemoveBomb(BaseBomb bomb) { if (BaseCurrentMap.Board[bomb.CellPosition.X, bomb.CellPosition.Y] is BaseBomb) BaseCurrentMap.Board[bomb.CellPosition.X, bomb.CellPosition.Y] = null; BaseCurrentMap.CollisionLayer[bomb.CellPosition.X, bomb.CellPosition.Y] = false; // Update the hazard map List<BaseBomb> bL = _baseBombList.FindAll(b => !b.InDestruction); foreach (Point p in bomb.ActionField) { bool sameCellThanAnOther = false; if (_baseBombList.Where( b => !(b.CellPosition.X == bomb.CellPosition.X && b.CellPosition.Y == bomb.CellPosition.Y)).Any( b => b.ActionField.Find(c => c.X == p.X && c.Y == p.Y) != Point.Zero)) { HazardMap[p.X, p.Y] = 2; sameCellThanAnOther = true; } if (!sameCellThanAnOther) HazardMap[p.X, p.Y] = 0; } _baseBombList.Remove(bomb); }
protected virtual void AddBomb(BaseBomb bomb) { BaseCurrentMap.Board[bomb.CellPosition.X, bomb.CellPosition.Y] = bomb; BaseCurrentMap.CollisionLayer[bomb.CellPosition.X, bomb.CellPosition.Y] = true; _baseBombList.Add(bomb); }