Exemplo n.º 1
0
 public void PrepareToBuy(CropAssets _buyingCropAssets)
 {
     buyingCropAssets = _buyingCropAssets;
     buyPanel.DisplayItem(buyingCropAssets.cropSprite,
                          buyingCropAssets.buyingCost * buyingCropAssets.priceMultiplier);
     buyPanel.GetComponent <Animator>().SetTrigger("Active");
 }
Exemplo n.º 2
0
 void GetDataFromAsset(CropAssets asset)
 {
     minGrowthRate = asset.minGrowthRate;
     maxGrowthRate = asset.maxGrowthRate;
     waterToGrowth = asset.waterToGrowth;
     maximumCost   = asset.maximumSellingCost;
 }
Exemplo n.º 3
0
 public Crop(CropAssets a)
 {
     if (a != null)
     {
         asset = a;
         InitializeValue();
         GetDataFromAsset(a);
     }
     else
     {
         InitializeValue();
     }
 }
Exemplo n.º 4
0
 public void PlantFromPlayer(CropAssets cropAsset)
 {
     if (PlayerManager.Instance.cropAmountList.ContainsKey(cropAsset) &&
         PlayerManager.Instance.cropAmountList[cropAsset] > 0 &&
         !crop.HasCrop())
     {
         crop = new Crop(cropAsset);
         overlayObj.GetComponent <SpriteRenderer>().sprite = crop.GetSprite();
         PlayerManager.Instance.cursorImage.GetComponent <Animator>().SetTrigger("Pressed");
         SoundManager.Instance.sfxManager.PlayFromSFXObjectLibrary("Plant");
         PlayerManager.Instance.cropAmountList[cropAsset] -= 1;
         PlayerManager.Instance.SetInventory();
     }
 }
Exemplo n.º 5
0
 public void SetInventory(CropAssets _cropAsset, int _amount)
 {
     cropAsset        = _cropAsset;
     amount           = _amount;
     cropImage.sprite = _cropAsset.cropSprite;
     if (cropImage.sprite == null)
     {
         cropImage.color = Color.clear;
     }
     else
     {
         cropImage.color = Color.white;
     }
     seedAmountText.text = amount.ToString();
 }
Exemplo n.º 6
0
    public void RandomPromo()
    {
        if (cropList.Count < 1)
        {
            RefreshCropList();
        }
        CropAssets targetCrop = cropList[Random.Range(0, cropList.Count - 1)];
        float      multiplier = 1f + ((float)Random.Range(-5, 5)) / 10.0f;

        if (multiplier == 1f)
        {
            RandomPromo();
            return;
        }
        if (targetCrop == null)
        {
            return;
        }
        CreatePromo(targetCrop, multiplier);
    }
Exemplo n.º 7
0
    public void CreatePromo(CropAssets targetCrop, float multiplier)
    {
        ResetCrop();

        bannerImage.gameObject.SetActive(true);
        targetCrop.priceMultiplier = multiplier;
        int percentChange = Mathf.Abs(Mathf.RoundToInt((multiplier - 1f) * 100f));

        if (multiplier > 1.0f)
        {
            if (notifManager == null)
            {
                notifManager = (UI_TextNotif)FindObjectOfType(typeof(UI_TextNotif));
            }
            notifManager.Notify("Monthly Promo: " + percentChange.ToString() +
                                "% Markup for", targetCrop.cropSprite);
            bannerImage.sprite = overpriceBanner;
            bannerText.text    = percentChange.ToString() + "% Markup";
        }
        else if (multiplier < 1.0f)
        {
            if (notifManager == null)
            {
                notifManager = (UI_TextNotif)FindObjectOfType(typeof(UI_TextNotif));
            }
            notifManager.Notify("Monthly Promo: " + percentChange.ToString() +
                                "% Off for", targetCrop.cropSprite);
            bannerImage.sprite = saleBanner;
            bannerText.text    = percentChange.ToString() + "% Off";
        }
        else
        {
            promoCooldown = 4;
            bannerImage.gameObject.SetActive(false);
            UpdateShop();
            return;
        }
        itemImage.sprite = targetCrop.cropSprite;
        promoCooldown    = 4;
        UpdateShop();
    }