Ejemplo n.º 1
0
        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.");
            }
        }
Ejemplo n.º 2
0
        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
                                                  ));
            }
        }
Ejemplo n.º 3
0
    // 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);
    }
Ejemplo n.º 4
0
        /// <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();
        }
Ejemplo n.º 5
0
    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);
    }