示例#1
0
    void Awake()
    {
        farmSelManager = GameObject.Find("Farm_Selector").GetComponent <farmManager>();
        seedSelManager = GameObject.Find("Seed_Selector").GetComponent <seedManager>();

        if (PlayerPrefs.HasKey("FarmSelected") && PlayerPrefs.HasKey("SeedSelected"))
        {
            blackPanel.SetActive(true);

            foreach (farmType aux in farmSelManager.farmTypes)
            {
                if (aux.farmName == PlayerPrefs.GetString("FarmSelected"))
                {
                    farmSelManager.typeFarm = aux;
                    gotoSelectSeed();
                }
            }

            foreach (seedType aux in seedSelManager.seedTypes)
            {
                if (aux.seedName == PlayerPrefs.GetString("SeedSelected"))
                {
                    seedSelManager.typeSeed = aux;
                    gotoGame();
                }
            }
        }
    }
 void Awake()
 {
     if (sharedInstance == null)
     {
         sharedInstance = this;
     }
     else if (sharedInstance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }