private void Start() { RecordLevelSave = FindObjectOfType <RecordLevelSave>(); LevelUIController levelUIController = FindObjectOfType <LevelUIController>(); if (levelUIController != null) { OnMapChanged += levelUIController.SetStoneCells; OnMove += levelUIController.SetMovesCount; OnVictory += levelUIController.Win; OnStepMade += levelUIController.SetBack; levelUIController.SetLevelName(CurrentLevel.Name); if (RecordLevelSave != null) { levelUIController.SetMovesRecord(RecordLevelSave.GetRecordByLevelID(CurrentLevel)); } } saveController = FindObjectOfType <SaveController>(); SaveData sd = null; if (saveController != null) { sd = saveController.GetSave(CurrentLevel.ID, CurrentLevel.Name); if (sd != null) { movesCount = sd.MovesCount; } OnMove?.Invoke(movesCount); } GenUtil.SetPrefabs(CellPrefab, StonePrefab, CellContainerPrefab, CellPitPrefab, CellSolvePartPrefab, CellPitSolvePartPrefab); GenUtil.CountParameters(Parent, CurrentLevel.W, CurrentLevel.H, Gap, StoneDeltaTime); map = GenUtil.GenerateLevel(Parent, CurrentLevel, sd); upReserve = GenUtil.GenerateReserveUp(Parent, CurrentLevel, sd); leftReserve = GenUtil.GenerateReserveLeft(Parent, CurrentLevel, sd); GetTargetCellsCount(); if (levelUIController != null) { levelUIController.SetStonesTotal(GenUtil.AllStones.Count); } }