public void Restart() { _guestsManager.Reset(); _gameModel.VisibleValues.CollectedMoney = 0; _timer.Reset(_cycleDuration); _timer.Unpause(); var storylineDict = CsvReader.Read(_storylineData); foreach (var storylineEntry in storylineDict) { if (storylineEntry.TryGetValue("EventType", out var eventType)) { var eventTypeStr = (string)eventType; if (string.IsNullOrEmpty(eventTypeStr)) { continue; } var characterStr = (string)storylineEntry["Character"]; var guestParams = _guestsManager.GetGuestByCharacter(characterStr); if (guestParams == null && characterStr != "Barman") { Debug.LogError($"Guest not found by character {characterStr}"); continue; } var startTime = (int)storylineEntry["StartTime"]; switch (eventTypeStr) { case "Enter": { _timeline.AddCommand(_commandsFactory.CreateTimeCommand(new GuestEnterCommand { StartTime = startTime, GuestParams = guestParams, Duration = (int)storylineEntry["Duration"], ChairIndex = (int)storylineEntry["ChairIndex"], })); break; } case "Leave": { _timeline.AddCommand(_commandsFactory.CreateTimeCommand(new GuestLeaveCommand() { StartTime = startTime, GuestParams = guestParams, Duration = (int)storylineEntry["Duration"], })); break; } case "Talk": { if (characterStr == "Barman") { _timeline.AddCommand(_commandsFactory.CreateTimeCommand(new BarmanTalkCommand() { StartTime = startTime, GuestParams = guestParams, Duration = (int)storylineEntry["Duration"], TextEng = (string)storylineEntry["TextEng"], TextRus = (string)storylineEntry["TextRus"], })); break; } _timeline.AddCommand(_commandsFactory.CreateTimeCommand(new GuestTalkCommand() { StartTime = startTime, GuestParams = guestParams, Duration = (int)storylineEntry["Duration"], TextEng = (string)storylineEntry["TextEng"], TextRus = (string)storylineEntry["TextRus"], })); break; } case "Clue": { _timeline.AddCommand(_commandsFactory.CreateTimeCommand(new GuestClueCommand() { StartTime = startTime, GuestParams = guestParams, Duration = (int)storylineEntry["Duration"], ReportEng = (string)storylineEntry["ReportEng"], ReportRus = (string)storylineEntry["ReportRus"], })); break; } case "Order": { var drinkName = (string)storylineEntry["Drink"]; var drinkParams = _controller.GlobalParams.DrinkList.FirstOrDefault(d => d.Name == drinkName); if (drinkParams == null) { Debug.LogError($"Drink not found: {drinkName}"); continue; } _timeline.AddCommand(_commandsFactory.CreateTimeCommand(new GuestOrderCommand() { StartTime = startTime, GuestParams = guestParams, DrinkParams = drinkParams, Duration = (int)storylineEntry["Duration"], })); break; } default: { Debug.LogError($"Can't handle storyline entry of type {eventType}"); break; } } } } }