public void ChangePlotState(PlotState ps, CalendarPlotTimeSpan span = new CalendarPlotTimeSpan()) { switch (ps) { case PlotState.ReadyToPlay: parent.playingPlot.Remove(this); parent.Calendar.Add(this, span); Init(); break; case PlotState.Playing: parent.playingPlot.Add(this); if (Services.game.runState == RunState.Load) { LateStart(); } else { Start(); } onPlotStart.Invoke(); break; case PlotState.Finished: parent.playingPlot.Remove(this); OnFinished(); onPlotFinish.Invoke(); parent.Calendar[this] = new CalendarPlotTimeSpan() { startTime = parent.Calendar[this].startTime, potentialBreakTime = DateTime.Now }; break; case PlotState.Broke: parent.playingPlot.Remove(this); OnBreak(); onPlotBreak.Invoke(); parent.Calendar[this] = new CalendarPlotTimeSpan() { startTime = parent.Calendar[this].startTime, potentialBreakTime = DateTime.Now }; break; case PlotState.Abandoned: parent.playingPlot.Remove(this); OnAbandon(); CoroutineManager.DoOneFrameDelay((() => { parent.Calendar[this] = new CalendarPlotTimeSpan() { startTime = parent.Calendar[this].startTime, potentialBreakTime = DateTime.Now }; })); break; } _plotState = ps; }
public override void OnExit() { foreach (var item in Parent.CurrentState.relatedObj) { if (item.CompareTag("PageObj")) { CoroutineManager.DoOneFrameDelay(delegate { item.transform.parent.gameObject.SetActive(false); }); } } }