//Vector2 temp = new Vector2();
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        Scene getName = SceneManager.GetActiveScene();

        PlayerPrefs.SetString("Scene", getName.name);
        PlayerPrefs.SetString("LastScene", getName.name);
        if (LoadingScene.instance != null)
        {
            LoadingScene.instance.FadeOut = true;
        }
        if (Map.instance != null)
        {
            Destroy(Map.instance);
        }
        int i = 0;

        foreach (GameObject _planet in planets)
        {
            i++;
        }
        PlayerPrefs.SetInt("LastPlanetID", i);
        if (PlayerPrefs.GetInt("AutoFlying") == 1 && PlayerPrefs.GetInt("PlayingPlanet") != -1)
        {
            StartCoroutine(ChangeToScene(PlayerPrefs.GetInt("CompleteLastPlanet")));
            PlayerPrefs.SetInt("AutoFlying", 0);
        }
        _IsGameStartedForTheFirstTime();
        _setOpenPlanet();
        _setSpaceshipPosition();
        // PlayerPrefs.SetInt("IsGameStartedForTheFirstTime");
    }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     selectPlanetManager = GameObject.Find("SelectPlanetManager").GetComponent <SelectPlanetManager>();
     text = GetComponent <Text>();
 }