//private void SetUpObjectivePointer() //{ // Transform playerTransform = FindObjectOfType<PlayerBehaviour>().transform; // objectivePointer = Instantiate(pointerPrefab, playerTransform.position, Quaternion.identity); // objectivePointer.Init(playerTransform, FindObjectOfType<MainPowerSwitch>().transform); // objectivePointer.ActivatePointer(); //} //private void SetUpRechargePointer() //{ // Transform playerTransform = FindObjectOfType<PlayerBehaviour>().transform; // rechargePointer = Instantiate(rechargePointerPrefab, playerTransform.position, Quaternion.identity); // rechargePointer.Init(playerTransform, FindObjectOfType<RechargeStationBehaviour>().transform); // rechargePointer.ActivatePointer(); //} private void OnDestroy() { InitStateManager.instance.OnStateChange -= EvaluateInitState; GameStateManager.instance.OnGameStateChange -= EvaluateGameState; SaveData.current.lastSession.tutorialCompleted = true; SerialisationManager.Save(InitStateManager.SaveName, SaveData.current); }
public void ReturnToTitleScreen() { AudioManager.instance.PlayAtRandomPitch("ClickSFX"); GameStateManager.instance.ResumeGame(); pauseScreen.SetActive(false); SerialisationManager.Save(InitStateManager.SaveName, SaveData.current); InitStateManager.instance.BeginNewState(InitStates.LoadTitleScreen); }
public void Play() { //SaveData.current = new SaveData(); SaveData.current.ClearSave(); MusicManager.instance.BeginFadeOut(); TransitionManager.instance.StartLevel(SceneIndex.IceRink); AudioManager.instance.PlayAtRandomPitch("ClickSFX"); SaveData.current.lastSession.isNewSave = false; SerialisationManager.Save(InitStateManager.SaveName, SaveData.current); }
private void DecrementTutorialsLeft() { nTutorialsLeft--; if (nTutorialsLeft <= 0) { SaveData.current.lastSession.tutorialCompleted = true; SerialisationManager.Save(InitStateManager.SaveName, SaveData.current); Destroy(gameObject); } }
public void Continue() { SaveData.current = (SaveData)SerialisationManager.Load(Application.persistentDataPath + "/Saves" + InitStateManager.SaveName + ".save"); AudioManager.instance.PlayAtRandomPitch("ClickSFX"); InitStateManager.instance.ContinueGame(); if (SaveData.current.lastSession.lastLevel != SceneIndex.TabletMenu) { TransitionManager.instance.StartLevel(SaveData.current.lastSession.lastLevel); } else { InitStateManager.instance.BeginNewState(InitStates.LoadMainMenu); } }
private void Awake() { if (instance == false) { instance = this; } else { Destroy(gameObject); } runTimeData.firstBoot = false; DontDestroyOnLoad(gameObject); if ((SaveData)SerialisationManager.Load(Application.persistentDataPath + "/Saves" + SaveName + ".save") == null) { SaveData.current = new SaveData(); } else { SaveData.current = (SaveData)SerialisationManager.Load(Application.persistentDataPath + "/Saves" + SaveName + ".save"); } }
public void BeginNewState(InitStates newState) { switch (newState) { case InitStates.InitLevel: GameStateManager.instance.BindToInitManager(); currInitState = newState; OnStateChange?.Invoke(currInitState); break; case InitStates.PlayerSpawned: OnStateChange?.Invoke(newState); Debug.Log("Player spawned"); LoadingScreen.instance.cam.SetActive(false); LoadingScreen.instance.BeginFade(false); currInitState = InitStates.GameRunning; BeginNewState(currInitState); break; case InitStates.GameRunning: OnStateChange?.Invoke(newState); currGameMode = GameModes.Powercut; //LoadingScreen.instance.ToggleScreen(false); break; case InitStates.LevelLoaded: currInitState = newState; GameStateManager.instance.BindToInitManager(); SerialisationManager.Save(SaveName, SaveData.current); OnStateChange?.Invoke(currInitState); break; case InitStates.LevelClear: currInitState = newState; SerialisationManager.Save(SaveName, SaveData.current); OnStateChange?.Invoke(currInitState); break; case InitStates.ExitLevel: LoadingScreen.instance.ToggleScreen(true); currInitState = newState; SerialisationManager.Save(SaveName, SaveData.current); OnStateChange?.Invoke(currInitState); break; case InitStates.LoadTitleScreen: currInitState = newState; SerialisationManager.Save(SaveName, SaveData.current); OnStateChange?.Invoke(currInitState); break; case InitStates.TitleScreen: LoadingScreen.instance.BeginFade(false); currInitState = newState; OnStateChange?.Invoke(currInitState); currGameMode = GameModes.Menu; break; case InitStates.Credits: LoadingScreen.instance.BeginFade(false); currInitState = newState; OnStateChange?.Invoke(currInitState); currGameMode = GameModes.Menu; break; case InitStates.LoadMainMenu: currInitState = newState; OnStateChange?.Invoke(currInitState); break; case InitStates.MainMenu: LoadingScreen.instance.BeginFade(false); currInitState = newState; currGameMode = GameModes.Menu; SerialisationManager.Save(SaveName, SaveData.current); OnStateChange?.Invoke(currInitState); break; case InitStates.PlayerSceneLoaded: OnStateChange?.Invoke(newState); PointerManager.instance.SwitchToCrossHair(); WeaponManager.instance.BindToInitManager(); FindObjectOfType <LightManager>().BindToInitManager(); FindObjectOfType <PlayerBehaviour>().BindToInitManager(); GameStateManager.instance.Init(); currInitState = InitStates.SpawnPlayer; OnStateChange?.Invoke(currInitState); break; case InitStates.UISceneLoaded: currInitState = newState; PauseScreen.instance.Resume(); UIManager.instance.Init(); UIManager.instance.BindToInitManager(); OnStateChange?.Invoke(currInitState); break; case InitStates.PlayerDead: currInitState = newState; OnStateChange?.Invoke(currInitState); break; case InitStates.RespawnPlayer: LoadingScreen.instance.ToggleScreen(true); currInitState = newState; OnStateChange?.Invoke(currInitState); break; case InitStates.PlayerRespawned: currInitState = newState; OnStateChange?.Invoke(currInitState); LoadingScreen.instance.BeginFade(false); currInitState = InitStates.GameRunning; OnStateChange?.Invoke(currInitState); break; } }
public void Quit() { AudioManager.instance.PlayAtRandomPitch("ClickSFX"); SerialisationManager.Save(InitStateManager.SaveName, SaveData.current); Application.Quit(); }
private IDictionary<string, string> GetPropertiesFromFile(string propertyFile) { Args.NotNullOrEmpty(propertyFile, "propertyFile"); PreProcessorConfig config = new SerialisationManager(fileSystem).DeserializeXmlFile<PreProcessorConfig>(propertyFile); return this.LoadDictionary(config); }
private PreProcessorManifest GetProcessorManfiest(string manifestFile) { var manifest = new SerialisationManager(this.fileSystem).DeserializeXmlFile<PreProcessorManifest>(manifestFile); if (manifest.Default == null) { throw new XmlDidNotPassValidationException("Default element missing from manifest."); } foreach (var group in manifest.Default.Groups) { ValidateGroup(group); } if (manifest.Environments != null) { foreach (var environment in manifest.Environments) { if (environment.Configuration != null) { ValidateConfiguration(environment.Configuration); } if (environment.Groups != null) { foreach (var group in environment.Groups) { ValidateGroup(group); } } } } return manifest; }
private Tuple<string, string> GetDefaultPropertyConfiguration(string environment, PreProcessorManifest processorManfiest, string manifestFile) { string staticFile = null; string overrideFile = null; var propertyConfigurationManifestFileAbsolutePath = ResolvePath(fileSystem.GetDirectoryFullPath(manifestFile), processorManfiest.Default.PropertyConfigurationManifest); var propertyConfigurationManifest = new SerialisationManager(this.fileSystem).DeserializeXmlFile<PropertyConfigurationManifest>(propertyConfigurationManifestFileAbsolutePath); if (propertyConfigurationManifest.Environments == null) { throw new XmlDidNotPassValidationException("Environments element missing from property configuration manifest."); } var env = propertyConfigurationManifest.Environments.FirstOrDefault(x => x.Name == environment); if (env == null) { throw new InvalidOperationException(string.Format("Environment '{0}' not found in property configuration manifest file.", environment)); } var configSettings = env.Configuration; if (configSettings == null) { throw new InvalidOperationException(string.Format("Environment Configuration '{0}' not found in property configuration manifest file.", environment)); } var root = fileSystem.GetDirectoryFullPath(propertyConfigurationManifestFileAbsolutePath); staticFile = ResolvePath(root, configSettings.StaticFile); if (configSettings.OverrideFile != null) { overrideFile = ResolvePath(root, configSettings.OverrideFile); } return new Tuple<string, string>(staticFile, overrideFile); }