Created
January 14, 2023 13:04
-
-
Save 314pies/ee6579919264d52affd8df8af76d7952 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void UpdateFood(float dt, bool forceUpdate) | |
{ | |
this.m_foodUpdateTimer += dt; | |
if (this.m_foodUpdateTimer >= 1f || forceUpdate) | |
{ | |
this.m_foodUpdateTimer -= 1f; | |
foreach (Player.Food food in this.m_foods) | |
{ | |
food.m_time -= 1f; | |
float num = Mathf.Clamp01(food.m_time / food.m_item.m_shared.m_foodBurnTime); | |
num = Mathf.Pow(num, 0.3f); | |
food.m_health = food.m_item.m_shared.m_food * num; | |
food.m_stamina = food.m_item.m_shared.m_foodStamina * num; | |
food.m_eitr = food.m_item.m_shared.m_foodEitr * num; | |
if (food.m_time <= 0f) | |
{ | |
this.Message(MessageHud.MessageType.Center, "$msg_food_done", 0, null); | |
this.m_foods.Remove(food); | |
break; | |
} | |
} | |
float health; | |
float stamina; | |
float num2; | |
this.GetTotalFoodValue(out health, out stamina, out num2); | |
health = 500f; | |
this.SetMaxHealth(health, true); | |
this.SetMaxStamina(stamina, true); | |
this.SetMaxEitr(num2, true); | |
if (num2 > 0f) | |
{ | |
this.ShowTutorial("eitr", false); | |
} | |
} | |
if (!forceUpdate) | |
{ | |
this.m_foodRegenTimer += dt; | |
if (this.m_foodRegenTimer >= 10f) | |
{ | |
this.m_foodRegenTimer = 0f; | |
float num3 = 0f; | |
foreach (Player.Food food2 in this.m_foods) | |
{ | |
num3 += food2.m_item.m_shared.m_foodRegen; | |
} | |
if (num3 > 0f) | |
{ | |
float num4 = 1f; | |
this.m_seman.ModifyHealthRegen(ref num4); | |
num3 *= num4; | |
num3 = 150f; | |
base.Heal(num3, true); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment