static public Player BuildPlayer() { var builder = new FieldBuilder(); var field = builder .BuildField(10, 10) .BuildShip(4) .BuildShip(3) .BuildShip(3) .BuildShip(2) .BuildShip(2) .BuildShip(2) .BuildShip(1) .BuildShip(1) .BuildShip(1) .BuildShip(1) .GetField(); var player = new Player { Field = field }; return(player); }
private void Initialize() { // PlayerPrefs.DeleteAll(); _player.OnTreasuresChange += _treasuresCounter.HandleNewValue; _player.OnShovelsChange += _shovelsCounter.HandleNewValue; _player.OnGameEnded += HandleGameEnded; _chest.Initialize(); var playerData = DataManager.Instance.GetPlayerData(); var fieldData = DataManager.Instance.GetFieldData(); if (playerData != null && fieldData != null) { _player.Initialize(playerData); _fieldBuilder.BuildField(fieldData); } else { Restart(); } }