Esempio n. 1
0
    /// <summary>
    /// The DeleteAll button on the load screen is for debugging purposes only!
    /// Remove the button and this scripts before shipping game, lol
    /// </summary>
    public void Delete()
    {
        if (LoadPlayerList() == null)
        {
            return;
        }
        names = LoadPlayerList();

        //delete each player's data file
        foreach (string name in names)
        {
            if (File.Exists(Application.persistentDataPath + "/" + name + ".dat"))
            {
                Debug.Log(Application.persistentDataPath + "/" + name + " to be deleted");
                File.Delete(Application.persistentDataPath + "/" + name + ".dat");
            }
        }
        //now delete the playerlist file
        File.Delete(Application.persistentDataPath + "/playerList.dat");

        //Reload load screen
        Scene_Switcher newScene = gameObject.AddComponent <Scene_Switcher>();

        newScene.ChangeScene("loadGame");
    }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        //when timer is finished the chest will disappear
        //and an object will be awarded to the player
        if (timerRunning == true && newTimer.Finished == true)
        {
            AwardObject();
            timerRunning = false;
        }

        //controls the awarded objects behavior
        //rises out of treasure chest
        if (objectVisible == true)
        {
            awardedObject.transform.position = Vector3.MoveTowards(awardedObject.transform.position,
                                                                   moveObjectTowards, 2 * Time.deltaTime);
            if (awardedObject.transform.position == moveObjectTowards)
            {
                SendObjectToUIBar();
            }
        }
        if (finalTimer == true && finalTime.Finished == true)
        {
            //Reload load screen
            Scene_Switcher newScene = gameObject.AddComponent <Scene_Switcher>();
            newScene.ChangeScene("scene1");
        }
    }
Esempio n. 3
0
    public void NextButtonPressed()
    {
        inputFieldtext = inputField.text;
        if (inputFieldtext == null || inputFieldtext == "" || inputFieldtext == inputField.placeholder.GetComponent <Text>().text)
        {
            return;
        }
        if (!File.Exists(Application.persistentDataPath + "/playerList.dat"))
        {
            CreateNewPlayerListFile();
        }
        List <string> playerList = LoadPlayerList();

        if (CheckForDuplicates(playerList))
        {
            return;
        }
        if (playerList[0] == "Default")
        {
            playerList.Remove("Default");
        }
        playerList.Add(inputFieldtext);
        SavePlayerList(playerList);
        CreateNewPlayerFile();

        //Now call the new scene loader script and begin the search scene
        Scene_Switcher newScene = gameObject.AddComponent <Scene_Switcher>();

        newScene.ChangeScene("scene1");
    }
Esempio n. 4
0
    //Now call the new scene loader script and begin the search scene
    private void NextScene()
    {
        Scene_Switcher newScene = gameObject.AddComponent <Scene_Switcher>();

        newScene.ChangeScene("scene1");
    }