/// <summary> /// Unity event. /// </summary> private void Start() { GameplayState gameplayState = SceneManager.Instance.GameplayState; RoomSelectable = gameplayState.Room.GetComponent <Selectable>(); InvoiceData.ClearData(); Mission mission = null; if (GameplayState.MissionToLoad == ModMission.CUSTOM_MISSION_ID) { mission = GameplayState.CustomMission; } else { mission = MissionManager.Instance.GetMission(GameplayState.MissionToLoad); } InvoiceData.MissionName = mission?.DisplayName; if (string.IsNullOrEmpty(InvoiceData.MissionName)) { InvoiceData.MissionName = "Free Play"; } FactoryGameModePicker.GameMode gameModeEnum; GameMode = FactoryGameModePicker.CreateGameMode(GameplayState.MissionToLoad, gameObject, out gameModeEnum); InvoiceData.GameMode = gameModeEnum; QuickDelay(() => GameMode.Setup(this)); OnLightChange(false); }
/// <summary> /// Unity event. /// </summary> private void Start() { GameplayState gameplayState = SceneManager.Instance.GameplayState; RoomSelectable = gameplayState.Room.GetComponent <Selectable>(); InvoiceData.ClearData(); Mission mission = gameplayState.Mission; InvoiceData.MissionName = mission != null?Localization.GetLocalizedString(mission.DisplayNameTerm != "Freeplay"?mission.DisplayNameTerm : "Missions/freeplay_DisplayName") : null; FactoryGameModePicker.GameMode gameModeEnum; GameMode = FactoryGameModePicker.CreateGameMode(GameplayState.MissionToLoad, gameObject, out gameModeEnum); InvoiceData.GameMode = gameModeEnum; QuickDelay(() => GameMode.Setup(this)); OnLightChange(false); KMModSettings modSettings = GetComponent <KMModSettings>(); ModSettings activeModSettings = JsonConvert.DeserializeObject <ModSettings>(modSettings.Settings); GetComponent <SpoopyScares>().enabled = activeModSettings.halloweenEvent; }
private static FactoryGameMode CreateGameMode(GameMode gameMode, GameObject gameObject) { GameModeTypeAttribute attribute = gameMode.GetAttributeOfType <GameModeTypeAttribute>(); if (attribute != null) { Logging.Log("Creating gamemode '{0}'.", attribute.FriendlyName); FactoryGameMode factoryGameMode = Activator.CreateInstance(attribute.Type) as FactoryGameMode; Type[] adapations = gameMode.GetGameModeAdapations(); if (adapations != null) { foreach (Type adaptationType in adapations) { factoryGameMode.AddAdaptation(adaptationType); } } return(factoryGameMode); } else { Logging.Log("Creating gamemode '{0}'.", GameMode.Static.GetFriendlyName()); return(new StaticMode()); } }
private void Update() { if (_gameMode == null) { FactoryRoom factoryRoom = FindObjectOfType <FactoryRoom>(); if (factoryRoom == null) { DestroyImmediate(gameObject); return; } _gameMode = factoryRoom.GameMode; return; } float currentTime = _gameMode.RemainingTime; if (currentTime < _previousTime) { if (ShouldTrigger(AllAvailableExpertsTime, currentTime, _previousTime)) { PlayWalkie(AllAvailableExperts); } else if (ShouldTrigger(EvacuateTime, currentTime, _previousTime)) { PlayWalkie(Evacuate); } } else { if (ShouldTrigger(AllAvailableExpertsTime, _previousTime, currentTime)) { PlayWalkie(EmergencyCleared); } } _previousTime = currentTime; }