public void Awake() { if (PlayerGameManager.GetInstance == null) { DontDestroyOnLoad(this.gameObject); instance = this; } else { Destroy(this.gameObject); } }
public override void PreOpenManager() { base.PreOpenManager(); Debug.Log("Starting Kingdom Events Manager"); playerData = new PlayerKingdomData(); playerData = PlayerGameManager.GetInstance.playerData; // ADD ONBOARDING HERE ONCE BALANCING IS DONE if (PlayerGameManager.GetInstance != null) { if (TransitionManager.GetInstance.isNewGame && !DramaticActManager.GetInstance.currentlyPlayingDrama) { } else if (TransitionManager.GetInstance.currentSceneManager.sceneType == SceneType.Courtroom) { PlayerGameManager mgr = PlayerGameManager.GetInstance; LoadSavedData(mgr.playerData.queuedDataEventsList, mgr.playerData.curDataEvent, mgr.playerData.curDataStory); // CHECKS IF LOADED DATA STILL HAS QUEUED EVENTS if (mgr.playerData.eventFinished < 3) { if (mgr.playerData.queuedDataEventsList.Count > 0 || mgr.playerData.curDataEvent != null && !string.IsNullOrEmpty(mgr.playerData.curDataEvent.title)) { AllowStartEvent(); // PREOPEN } else { StartWeekEvents(); } } } } else { StartWeekEvents(); } }
public void StartWeekEvents() { if (DramaticActManager.GetInstance.currentDrama != null) { return; } weeklyEvents = ((int)playerData.level + 1) * 3; int eventsToAdd = weeklyEvents; Debug.Log("-------------- STARTING WEEK EVENTS! --------------"); List <EventDecisionData> temp = new List <EventDecisionData>(); // IF THERE'S an EXISTING STORY -> GET THE NEXT INDEX FIRST if (isInStory) { // Check if in Story - if (isInStory && eventStorage.EnableDebugging) { // Check currentStory Interval. if (currentStory.curEventIdx == 0) { // Check if we're past starting week if (currentStory.startingWeek <= playerData.weekCount) { currentEvent = currentStory.storyEvents[currentStory.curEventIdx]; eventsToAdd -= 1; } } else { if (currentStory.nextEventWeek <= playerData.weekCount) { currentEvent = currentStory.storyEvents[currentStory.curEventIdx]; eventsToAdd -= 1; } } } else { // CHECK WEEK REQUIREMENT int curWeek = playerData.weekCount; int nextEventIdx = currentStory.curEventIdx; if (curWeek >= currentStory.nextEventWeek) { if (eventStorage.ComputeStoryArcChance(curWeek, currentStory.storyEvents[nextEventIdx].difficultyType)) { //Debug.Log("------------- ADDING THRU START WEEK EVENT-------------------"); temp.Add(currentStory.storyEvents[nextEventIdx]); eventsToAdd -= 1; } } } } if (queuedEventsList.Count > eventsToAdd) { return; } if (TransitionManager.GetInstance.previousScene != SceneType.Courtroom) { // Check if there's Saved Events. PlayerGameManager mgr = PlayerGameManager.GetInstance; if (mgr.playerData.queuedDataEventsList.Count <= 0 || mgr.playerData.curDataEvent == null) { temp = eventStorage.ObtainWeeklyEvents(playerData.level, eventsToAdd, playerData, isInStory); } else { // if there is LoadSavedData(mgr.playerData.queuedDataEventsList, mgr.playerData.curDataEvent, mgr.playerData.curDataStory); savedDataLoaded = false; } } else { temp = eventStorage.ObtainWeeklyEvents(playerData.level, eventsToAdd, playerData, isInStory); } // Set QueueEvents queuedEventsList.AddRange(temp); if (ResourceInformationController.GetInstance.currentPanel != null) { ResourceInformationController.GetInstance.currentPanel.weekController.UpdateEndButton(0, weeklyEvents); } if (TransitionManager.GetInstance.currentSceneManager != null) { if (CourtroomSceneManager.GetInstance != null) { if (TransitionManager.GetInstance.currentSceneManager == CourtroomSceneManager.GetInstance) { CourtroomSceneManager.GetInstance.MakeGuardShow(() => AllowStartEvent()); } else { Debug.Log("Item Name: " + TransitionManager.GetInstance.currentSceneManager.gameObject.name + " Manager Name: " + CourtroomSceneManager.GetInstance.gameObject.name); } } } SaveData(); }