Cleanup BombUtilManager

This commit is contained in:
Denis-Cosmin Nutiu 2019-08-24 19:27:32 +03:00
parent 22af655678
commit 52a7a536c8

View file

@ -49,25 +49,21 @@ namespace src.Managers
public void RegisterBomb(Vector3 position) public void RegisterBomb(Vector3 position)
{ {
if (CanPlaceBomb(position)) if (!CanPlaceBomb(position)) return;
{
placedBombs++; placedBombs++;
_usedPosition.Add(position); _usedPosition.Add(position);
} }
}
public void UnregisterBomb(Vector3 position) public void UnregisterBomb(Vector3 position)
{ {
if (_usedPosition.Contains(position)) if (!_usedPosition.Contains(position)) return;
{
placedBombs--; placedBombs--;
_usedPosition.Remove(position); _usedPosition.Remove(position);
} }
}
public bool CanPlaceBomb(Vector3 position) public bool CanPlaceBomb(Vector3 position)
{ {
return (!_usedPosition.Contains(position) && (placedBombs < allowedBombs)); return !_usedPosition.Contains(position) && placedBombs < allowedBombs;
} }
} }
} }