private void PlantAt(Plantables plant, int x, int y) { // get farm patch at postion FarmPatch patch = world.Where(worldItem => worldItem.WorldPositionX == x && worldItem.WorldPositionY == y).FirstOrDefault(); if (patch != null) { // plant something there patch.Plant(plant); } }
public void Plant(Plantables toPlant) { plantObject = null; switch (toPlant) { case Plantables.Tree: plantObject = Instantiate(worldRef.GetComponent <World>().prefabList.treePrefab, this.gameObject.transform.position, Quaternion.identity); break; } if (plantObject != null) { plantObject.transform.parent = this.gameObject.transform; isDoneGrowing = true; isEmpty = false; } }