public void PlantSeedPlot(Seeds seedType) { if (mSeed.mType != SEED_TYPE.None) { return; } mSeed = seedType.ShallowCopy(); switch (seedType.mType) { //Updating UI case SEED_TYPE.Corn: //gameObject.sprite = cornSprite; gameObject.GetComponent <Image>().sprite = cornSprite; //gameObject.GetComponent<Image>().transform.localScale = new Vector3(.5f, .5f); break; case SEED_TYPE.Wheat: gameObject.GetComponent <Image>().sprite = wheatSprite; break; case SEED_TYPE.Potato: gameObject.GetComponent <Image>().sprite = potatoSprite; break; case SEED_TYPE.Hops: gameObject.GetComponent <Image>().sprite = hopsSprite; break; } harvestProgressBar.maximum = mSeed.mHarvestTimeCap; ToggleButtonsPlanted(); FarmingController.GetInstance().totalSeededPlots++; }
//Event driven void UpdateFarmingUI(UIFarmingUpdateEventInfo eventInfo) { CornCountText.text = FarmingController.GetInstance().mFarmingSeeds["Corn"].getCount().ToString(); WheatCountText.text = FarmingController.GetInstance().mFarmingSeeds["Wheat"].getCount().ToString(); PotatoCountText.text = FarmingController.GetInstance().mFarmingSeeds["Potato"].getCount().ToString(); HopsCountText.text = FarmingController.GetInstance().mFarmingSeeds["Hops"].getCount().ToString(); }
public void HarvestCrops() { //Determining our harvest and updating farmingcontrollers seed count int tempYield = (int)(mSeed.mHarvestYield * TalentBuffs.GetInstance().GetSeedModOutput(mSeed.mType)); switch (mSeed.mType) { case SEED_TYPE.Corn: FarmingController.GetInstance().mFarmingSeeds["Corn"].modifyCountCond(tempYield, 0); break; case SEED_TYPE.Wheat: FarmingController.GetInstance().mFarmingSeeds["Wheat"].modifyCountCond(tempYield, 0); break; case SEED_TYPE.Potato: FarmingController.GetInstance().mFarmingSeeds["Potato"].modifyCountCond(tempYield, 0); break; case SEED_TYPE.Hops: FarmingController.GetInstance().mFarmingSeeds["Hops"].modifyCountCond(tempYield, 0); break; } //Resetting the plot mSeed.mType = SEED_TYPE.None; overGrownProgress = 0.0f; gameObject.GetComponent <Image>().sprite = null; isTilled = false; ToggleButtonsHarvested(); //Sending notification to farmcontroller that we need an update FarmingController.GetInstance().totalSeededPlots--; FarmingController.GetInstance().UpdateMeDaddy(); FarmingController.GetInstance().farmingDetailScript.ClearPlot(ID); }