public void PrepareToBuy(CropAssets _buyingCropAssets) { buyingCropAssets = _buyingCropAssets; buyPanel.DisplayItem(buyingCropAssets.cropSprite, buyingCropAssets.buyingCost * buyingCropAssets.priceMultiplier); buyPanel.GetComponent <Animator>().SetTrigger("Active"); }
void GetDataFromAsset(CropAssets asset) { minGrowthRate = asset.minGrowthRate; maxGrowthRate = asset.maxGrowthRate; waterToGrowth = asset.waterToGrowth; maximumCost = asset.maximumSellingCost; }
public Crop(CropAssets a) { if (a != null) { asset = a; InitializeValue(); GetDataFromAsset(a); } else { InitializeValue(); } }
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(); } }
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(); }
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); }
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(); }