public void SetObject(ClickPotScript pot) { Vector3 spawnLocation = Camera.main.transform.position; if (spawnedObject == null) { GameObject prefabToInstantiate; //pot.PrefabToInstantiate; if (pot.Plant != null) { prefabToInstantiate = pot.Plant.SeedBagPrefab; } else if (Inventory.State.Seeds.Count - 1 > PlantMenuDropdown.value) { PlantPrefabScript menuPlant = Inventory.State.Seeds[PlantMenuDropdown.value].GetComponent <PlantPrefabScript>(); prefabToInstantiate = menuPlant.SeedBagPrefab; } else { return; } spawnedObject = Instantiate( prefabToInstantiate, spawnLocation, Camera.main.transform.rotation, Camera.main.transform ); // Debug.Log("clicked pot size: " + Size + ", soil: " + SoilAmount); } }
public void RemovePlant() { if (Plant == null) { return; } Destroy(Plant.gameObject); Plant = null; }
public void BuySeed(GameObject seedPrefab) { PlantPrefabScript seed = seedPrefab.GetComponent <PlantPrefabScript>(); if (Inventory.State.Cash < seed.Price) { return; } Inventory.State.Cash -= seed.Price; Inventory.State.Seeds.Add(seedPrefab); InventoryMenuScript.MainInstance.PopulateMenu(); AudioManager.instance.Play(BuySoundEffect); }