void DisplayInventory() { if (crop.HasCrop()) { //waterBar.gameObject.SetActive(false); iconBox.SetIcon(crop.GetCropSprite()); } else if (tool != null) { if (tool.isWaterCan) { //canUse = true; // waterBar.gameObject.SetActive(true); } else if (!tool.isWaterCan) { //canUse = false; // waterBar.gameObject.SetActive(false); } } else { // canUse = false; // waterBar.gameObject.SetActive(false); iconBox.Close(); } }
public void Interact(Crop c, PlayerInteraction player) { if (c.state == CropState.Done) { Debug.Log("Loading " + c.GetName() + " onto truck."); crops.Add(c); player.SetCrop(new Crop(null)); bool wasDelivery = Deliveries.instance.CompleteDelivery(c.asset); if (wasDelivery) { Debug.Log("DELIVERERY COMPLETED: " + c.GetName()); GameManager.IncreaseScore(50); } else { Debug.Log("Delivered: " + c.GetName()); GameManager.IncreaseScore(20); } GameObject go = Instantiate(iconPrefab, grid); Image img = go.GetComponent <Image>(); if (img != null) { img.sprite = c.GetCropSprite(); } } }
private void Start() { if (crop.HasCrop()) { overlay.sprite = crop.GetCropSprite(); } else if (tool != null) { overlay.sprite = tool.sprite; } }
void UpdateSprite() { overlay.sprite = crop.GetCropSprite(); if (crop.IsOnGround()) { overlay.sortingLayerName = onGroundLayer; } else { overlay.sortingLayerName = normalCropLayer; } }
void DisplayInventory() { if (crop.HasCrop()) { iconBox.SetIcon(crop.GetCropSprite()); } else if (tool != null) { iconBox.SetIcon(tool.sprite); } else { iconBox.Close(); } }
public void Interact(Crop c, Tool t, PlayerInteraction player) { player.SetCrop(crop); crop = c; player.SetTool(tool); tool = t; if (tool != null) { overlay.sprite = tool.sprite; } else if (crop != null) { overlay.sprite = crop.GetCropSprite(); } else { overlay.sprite = null; } }