mirror of
				https://github.com/DerTyp7/harvestdale-unity.git
				synced 2025-10-31 05:27:07 +01:00 
			
		
		
		
	add field functinallity
This commit is contained in:
		| @@ -3,12 +3,35 @@ using UnityEngine; | ||||
|  | ||||
| public class FieldController : Interactable | ||||
| { | ||||
|   public Field field; | ||||
|   public Crop testCrop; | ||||
|   private Field field; | ||||
|  | ||||
|   public override string interactText => field.State == FieldState.EMPTY ? "Plant" : field.State == FieldState.HARVESTABLE ? "Harvest" : field.State == FieldState.GROWING && !field.IsWatered ? "Water" : "Empty"; | ||||
|  | ||||
|   public void SetField(Field field) | ||||
|   { | ||||
|     this.field = field; | ||||
|   } | ||||
|  | ||||
|   public override void OnInteract() | ||||
|   { | ||||
|     Debug.Log("Interacting with field"); | ||||
|     field.Plant(testCrop); | ||||
|     if (field.State == FieldState.EMPTY) | ||||
|     { | ||||
|       if (FarmManager.Instance.CropInventory.Items.Length > 0) | ||||
|         field.Plant(FarmManager.Instance.CropInventory.Items[0].item); | ||||
|     } | ||||
|     else if (field.State == FieldState.HARVESTABLE) | ||||
|     { | ||||
|       field.Harvest(); | ||||
|     } | ||||
|     else if (field.State == FieldState.GROWING && !field.IsWatered) | ||||
|     { | ||||
|       field.Water(); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|       field.EmptyField(); | ||||
|     } | ||||
|  | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Janis
					Janis