private void Eat(GameObject food) { Hungry = false; currentHealth += food.GetComponent <Food>().healthGain; healthBar.UpdateDisplay(currentHealth / maxHealth); if (currentHealth >= maxHealth) { currentHealth = maxHealth; } timesEatenSinceLastGrowth += food.GetComponent <Food>().nourishment; if (timesEatenSinceLastGrowth >= growthLevel * additionalFoodsNeededToGrow + foodsNeededToGrow) { Grow(); } Destroy(food); targetFood = null; gm.audioManager.PlaySound("Fish Ate"); // change type if (food.GetComponent <Food>().foodType == FoodTypeEnum.laser) { lasersEaten++; this.PassiveIncomePerMinute = gm.scalingManager.ScaleFishPassiveIncome(growthLevel, true); this.FishType = FishTypeEnum.laser; damageDealtPerFrame = gm.scalingManager.ScaleLaserFishDPF(lasersEaten); } }
//////////////////////////////////////// // Start is called before the first frame update void Start() { InvokeRepeating("BeFishy", 0.0f, activityFrequency); InvokeRepeating("DropTreasure", 1f, treasureDropRate); // drop dropable InvokeRepeating("FindClosestFood", 1f, .1f); gm.shop.FriendlyFishCount++; gm.shop.PassiveIncome += this.passiveIncomePerMinute; this.FishType = this.fishType; // trigger setter }