private void CreateSaveFile() { //Check if the file name is valid BEFORE trying to create a new save file: if (SaveFileController.IsValidFileName(saveFileNameInputField.Text)) { SaveFile saveFile = new SaveFile(saveFileNameInputField.Text, playerNameInputField.Text); GameController.NewGame(); SaveFileController.SaveGame(saveFile); } else { CrashHandler.ShowException("Save file name \"" + saveFileNameInputField.Text + "\" is not a valid name."); } }
private void UpdateUISaveFiles() { uiSaveFileColumn.Clear(); foreach (FileInfo fileInfo in SaveFileController.GetSaveFiles()) { var tempFileInfo = fileInfo; uiSaveFileColumn.AddUIElement(new UISaveFile( new Transform(new Vector2(250, 200)), ContentHelper.Box4x4_Sprite, screen, tempFileInfo, canSave )); } }
// Use this for initialization void Start() { save = new SaveFileController(); //get the progress the player has made in the USA level group float usaProgress = save.GetProgress(MenuCountryScript.CountryName.USA); GameObject usaObj = GameObject.Find("MenuMapUSA"); usaObj.renderer.material.color = new Color((255 * usaProgress), (255 * (1.0f - usaProgress)), 0.0f); //get the progress the player has made in the Russia level group float russiaProgress = save.GetProgress(MenuCountryScript.CountryName.RUSSIA); GameObject russiaObj = GameObject.Find("MenuMapRussia"); russiaObj.renderer.material.color = new Color((255 * russiaProgress), (255 * (1.0f - russiaProgress)), 0.0f); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); DataController.Initialize(); SaveFileController.Initialize(); GameTipsController.Initialize(); AudioController.Initialize(); ShipyardController.Initialize(); GalaxyController.Initialize(); AudioController.PlayBackgroundSong("void"); GameUIController.Initialize(); GameUIController.CreateLoadingScreen(); LoadGame(); }
public void LevelComplete() { //set the level to complete levelComplete = true; player.rigidbody2D.velocity = Vector2.zero; player.GetComponent <Animator>().SetBool("isMoving", false); //remove any bullets in the level GameObject[] bullets = GameObject.FindGameObjectsWithTag("Bullet"); for (int i = 0; i < bullets.Length; i++) { Destroy(bullets[i]); } SaveFileController save = new SaveFileController(); save.SetLevelComplete(country, Application.loadedLevelName, score); }