Cleanup BombUtilManager
This commit is contained in:
parent
22af655678
commit
52a7a536c8
1 changed files with 7 additions and 11 deletions
|
@ -49,25 +49,21 @@ namespace src.Managers
|
|||
|
||||
public void RegisterBomb(Vector3 position)
|
||||
{
|
||||
if (CanPlaceBomb(position))
|
||||
{
|
||||
placedBombs++;
|
||||
_usedPosition.Add(position);
|
||||
}
|
||||
if (!CanPlaceBomb(position)) return;
|
||||
placedBombs++;
|
||||
_usedPosition.Add(position);
|
||||
}
|
||||
|
||||
public void UnregisterBomb(Vector3 position)
|
||||
{
|
||||
if (_usedPosition.Contains(position))
|
||||
{
|
||||
placedBombs--;
|
||||
_usedPosition.Remove(position);
|
||||
}
|
||||
if (!_usedPosition.Contains(position)) return;
|
||||
placedBombs--;
|
||||
_usedPosition.Remove(position);
|
||||
}
|
||||
|
||||
public bool CanPlaceBomb(Vector3 position)
|
||||
{
|
||||
return (!_usedPosition.Contains(position) && (placedBombs < allowedBombs));
|
||||
return !_usedPosition.Contains(position) && placedBombs < allowedBombs;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue