Example #1
0
    private void Start()
    {
        soundManager = SoundManager.instance;
        inventory.transform.SetParent(disableCanvas.transform, false);
        shop.transform.SetParent(disableCanvas.transform, false);
        placeButton.interactable = false;
        plantPlacer      = PlantPlacer.instance;
        infoManager      = InfoManager.instance;
        nature           = Nature.instance;
        plantsGrid       = GridMap.instance;
        shopManager      = FindObjectOfType <ShopManager>();
        inventoryManager = InventoryManager.instance;
        timeController   = FindObjectOfType <TimeController>();
        gameObjects      = inventoryManager.GetItemsPrefabs();

        string path = Application.persistentDataPath + SceneManagement.index + ".bin";

        Debug.Log(Application.persistentDataPath);

        if (File.Exists(path))
        {
            LoadGame(SceneManagement.index);
        }
        else
        {
            ShopManager.instance.moneyAmount = 20;
            Debug.Log(shopManager);

            for (int i = 0; i <= 3; i++)
            {
                ShopManager.instance.AddItemInShop(i);
            }
        }
    }
Example #2
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Example #3
0
 void Start()
 {
     plantPlacer  = PlantPlacer.instance;
     selectedItem = null;
 }