예제 #1
0
 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();
     }
 }
예제 #2
0
    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();
            }
        }
    }
예제 #3
0
 private void Start()
 {
     if (crop.HasCrop())
     {
         overlay.sprite = crop.GetCropSprite();
     }
     else if (tool != null)
     {
         overlay.sprite = tool.sprite;
     }
 }
예제 #4
0
 void UpdateSprite()
 {
     overlay.sprite = crop.GetCropSprite();
     if (crop.IsOnGround())
     {
         overlay.sortingLayerName = onGroundLayer;
     }
     else
     {
         overlay.sortingLayerName = normalCropLayer;
     }
 }
예제 #5
0
 void DisplayInventory()
 {
     if (crop.HasCrop())
     {
         iconBox.SetIcon(crop.GetCropSprite());
     }
     else if (tool != null)
     {
         iconBox.SetIcon(tool.sprite);
     }
     else
     {
         iconBox.Close();
     }
 }
예제 #6
0
    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;
        }
    }