/// <summary> /// All Triggers of the game by default/start /// </summary> /// <returns>true if game started</returns> public override void StartSetup() { //Initiates Variables if (GameScenario.Instance.simStartYear == 0) startDate = GameScenario.Instance.currentDate; else startDate = new DateTime(GameScenario.Instance.simStartYear, GameScenario.Instance.simStartMonth, GameScenario.Instance.simStartDay); TimeSpan span = startDate.AddYears ((int)GameScenario.Instance.simDurationInYears) - startDate; duration = (float) span.TotalDays; //in days //WebPlayerDebugManager.addOutput (duration + " Days from " + startDate + " till " + startDate.AddYears((int)GameScenario.Instance.simDurationInYears), 1); minutesPerYear = (float)P0000_GameParams.Instance.MinutesPerYear; GameObject obj = UIManager.Instance.GetPopup("SaveSimPopup"); if(obj) { obj.SetActive(false); } GameManager.Instance.RegisterEventHandler("TIMELINE", ProcessTimelineEvent); simMenu = UIManager.Instance.GetHud ("SimulationMenu"); simMenu.SetActive (true); scoreBoard = UIManager.Instance.GetHud ("ScoreBoard"); scoreBoard.SetActive (true); date = startDate; GameObject objSIM = UIManager.Instance.GetHud("TimeLineSIM"); timeLine = objSIM.GetComponent<TimeLine>(); maxValue = duration * (minutesPerYear * 60 / 365); timeLine.SetTimeBar(0,0,maxValue); //Edit TimelineSIM Dates //TODO When shall this start? string text = ""; text = I18nManager.Instance.Get ("Timeline", "003").Replace("SIMTAG1", startDate.Month + "." + startDate.Year); I18nManager.Instance.Set ("Timeline", "003", text); text = I18nManager.Instance.Get ("Timeline", "004").Replace("SIMBAU", startDate.AddDays (duration).Month + "." + startDate.AddDays (duration).Year); I18nManager.Instance.Set ("Timeline", "004", text); //Starts the Timeline GameManager.Instance.Event ("TIMELINE", "SIM", "Activate"); GameManager.Instance.Event ("TIMELINE", "SIM", "Start"); }
/// <summary> /// All Triggers of the game by default/start /// </summary> /// <returns>true if game started</returns> public override void StartSetup() { //create trigger CPTime startDate = GameScenario.Instance.currentDate.AddDays(2); duration = (float) GameScenario.Instance.cpDurationInDays;//float.Parse(GameConfiguration.Instance.GetValue("cpDurationInDays")); // in days minutesPerWeek = (float) P0000_GameParams.Instance.MinutesPerWeek; //5 minutes GameManager.Instance.RegisterEventHandler("TIMELINE", ProcessTimelineEvent); date = startDate; GameObject objCP = UIManager.Instance.GetHud("TimeLineCP"); timeLine = objCP.GetComponent<TimeLine>(); Log.Assert(timeLine, "Missing TimeLine"); maxValue = duration * (minutesPerWeek * 60 / 7); timeLine.SetTimeBar(0,0,maxValue); //Edit TimelineCP Dates string text = ""; text = I18nManager.Instance.Get ("Timeline", "001").Replace("TAG1", startDate.Day + "." + startDate.Month); I18nManager.Instance.Set ("Timeline", "001", text); text = I18nManager.Instance.Get ("Timeline", "002").Replace("BAU", startDate.AddDays(duration).Day + "." + startDate.AddDays(duration).Month); I18nManager.Instance.Set ("Timeline", "002", text); //UpdateCPTime (0); GameManager.Instance.Event ("TIMELINE", "CP", "Activate"); GameManager.Instance.Event ("TIMELINE", "CP", "Start"); }