//+++++++Task Functions++++++// //xFeed public void Feed(float amount, CropsAndBuffs.Buff buff_in, Utilities.CropTypes cropType_in) { if (buff_in.buffType != Utilities.BuffTypes.None) { currentBuff = buff_in; currentBuff.duration *= Utilities.BUFFSCALE; buffCropType = cropType_in; ApplyBuff(currentBuff); } //eating provides a small boost to all stats depending on how much was recovered //recoveryDifference is used to make sure this bonus doesn't encroach into full recovery //(ie: eating when already full) float recoveryDifference = currentAttributes[Utilities.Attributes.Recovery]; currentAttributes[Utilities.Attributes.Recovery] = Mathf.Min(currentAttributes[Utilities.Attributes.Recovery] + amount, 10); //recoveryDifference now refers to the difference between old and new recoveryDifference = currentAttributes[Utilities.Attributes.Recovery] - recoveryDifference; string floating = "+" + (Mathf.Round(recoveryDifference * 10) / 10).ToString() + " rec"; Utilities.FloatText(transform.position + new Vector3(0, 1, 0), floating, Utilities.TextTypes.Positive); for (int c = (int)Utilities.Attributes.Strength; c <= (int)Utilities.Attributes.Acumen; c++) { currentAttributes[(Utilities.Attributes)c] = Mathf.Min(currentAttributes[(Utilities.Attributes)c] + recoveryDifference * Utilities.MEALBONUS, maxAttributes[(Utilities.Attributes)c]); } //change buff in ui if needed if (gameController.selectedCitizen == this.gameObject) { GameObject.Find("Current_Buff_UI").GetComponent <CurrentBuffUI_Script>().SetBuff(); } }
/* xSetItem * called by cropbehavior when slotting a new item, * code varies by type of station and type of crop * also sets buff values*/ public virtual void SetItem(Utilities.CropTypes crop_in, Utilities.ItemTypes itemType_in, float restQuality_in, CropsAndBuffs.Buff buff_in) { timeToProduce = maxProductionTime; if (citizen1 != null) { citizen1Script.SetTaskAttributes(primaryEff, secondaryEff, primaryQual, secondaryQual, fatigueRate); Activate(); } if (citizen2 != null) { citizen2Script.SetTaskAttributes(primaryEff, secondaryEff, primaryQual, secondaryQual, fatigueRate); Activate(); } Utilities.SetCropTexture(this.gameObject.transform.GetChild(1).gameObject, crop_in); if (gameController.selectedTask == this.gameObject) { GameObject.Find("Current_Task_UI").GetComponent <CurrentTaskUI_Script>().SetTask(); } }
public void AddCrop(Utilities.CropTypes crop_in, float quality_in) { crops[crop_in].Add(quality_in); //print (crops[crop_in].Count); }
/* xSetItem * called by cropbehavior when slotting a new item, * code varies by type of station and type of crop * also sets buff values*/ public override void SetItem(Utilities.CropTypes crop_in, Utilities.ItemTypes itemType_in, float restQuality_in, CropsAndBuffs.Buff buff_in) { itemType = itemType_in; cropType = crop_in; restoreQuality = restQuality_in; CropsAndBuffs.Crop newCrop = CropsAndBuffs.cropList[cropType]; maxProductionTime = newCrop.timeToProduce * Utilities.TRADETIMERATIO / (Utilities.TIMESCALE); base.SetItem(crop_in, itemType_in, restQuality_in, buff_in); }
public bool hasCrop(Utilities.CropTypes crop_in) { if (crops[crop_in].Count != 0) { return(true); } else { return(false); } }
/* xSetItem * called by cropbehavior when slotting a new item, * code varies by type of station and type of crop * also sets buff values*/ public override void SetItem(Utilities.CropTypes crop_in, Utilities.ItemTypes itemType_in, float restQuality_in, CropsAndBuffs.Buff buff_in) { pestScript.RotateCrop(); itemType = itemType_in; cropType = crop_in; restoreQuality = restQuality_in; CropsAndBuffs.Crop newCrop = CropsAndBuffs.cropList[cropType]; primaryEff = newCrop.primaryEff; secondaryEff = newCrop.secondaryEff; primaryQual = newCrop.primaryQual; secondaryQual = newCrop.secondaryQual; fatigueRate = newCrop.fatigueRate; maxProductionTime = newCrop.timeToProduce / Utilities.TIMESCALE; base.SetItem(crop_in, itemType_in, restQuality_in, buff_in); }
/* xSetItem * called by cropbehavior when slotting a new item, * code varies by type of station and type of crop * also sets buff values*/ public override void SetItem(Utilities.CropTypes crop_in, Utilities.ItemTypes itemType_in, float restQuality_in, CropsAndBuffs.Buff buff_in) { itemType = itemType_in; cropType = crop_in; restoreQuality = restQuality_in; CropsAndBuffs.Crop newCrop = CropsAndBuffs.cropList[cropType]; if (itemType == Utilities.ItemTypes.Meal) { currentBuff = buff_in; } else { currentBuff.buffType = Utilities.BuffTypes.None; } recoveryRestore = newCrop.baseRecovery + newCrop.baseRecovery * restoreQuality; maxProductionTime = Utilities.EATTIME / Utilities.TIMESCALE; base.SetItem(crop_in, itemType_in, restQuality_in, buff_in); }
public void CreateCrop(Utilities.CropTypes crop_in, Utilities.ItemTypes type_in, GameObject creator_in, float restQuality_in, float buffQuality_in) { cropType = crop_in; itemType = type_in; creator = creator_in; restoreQuality = restQuality_in; buffQuality = buffQuality_in; if (itemType == Utilities.ItemTypes.Meal) { currentBuff = CropsAndBuffs.buffList[cropType]; currentBuff.maxDuration += currentBuff.maxDuration * restoreQuality; currentBuff.value += currentBuff.value * buffQuality_in; currentBuff.duration = currentBuff.maxDuration; } Utilities.SetCropTexture(this.gameObject, crop_in); if (itemType != Utilities.ItemTypes.Seed) { CreateIndicator(); } }
public void SetCrop(Utilities.CropTypes crop_in) { cropType = crop_in; }
public float RemoveCropHighest(Utilities.CropTypes crop_in) { return(GetHighestQuality(crops[crop_in])); }