public override bool UseItem(Player player) { SurvivariaPlayer modPlayer = player.GetModPlayer <SurvivariaPlayer>(); modPlayer.CurrentHunger = 100; modPlayer.CurrentThirst = 100; return(base.UseItem(player)); }
public override void Update(Player player, ref int buffIndex) { SurvivariaPlayer modPlayer = player.GetModPlayer <SurvivariaPlayer>(); player.lifeRegen -= 1; player.allDamageMult -= 0.08f; modPlayer.HungerLossMulti += 0.10f; }
public override bool UseItem(Item item, Player player) { if (!(item.modItem is SurvivariaItem || item.modItem is FoodItem || item.modItem is DrinkItem)) { SurvivariaPlayer modPlayer = player.GetModPlayer <SurvivariaPlayer>(); player.GetModPlayer <SurvivariaPlayer>().AddHunger(HungerAmount); player.GetModPlayer <SurvivariaPlayer>().AddThirst(ThirstAmount); } return(base.UseItem(item, player)); }
/// <summary> /// /// </summary> /// <param name="spriteBatch">Spritebatch.</param> /// <param name="player">Inst. player.</param> /// <param name="_texture">Bar texture.</param> /// <param name="divideBy">Divide by the amount of frames required to find the height of each frame.</param> /// <param name="frameFormula">The formula for frame display.</param> /// <param name="drawPosX">Modify the PosX draw. Do always divisible by 8. *8, *16, *24</param> /// <param name="drawPosY">Modify the PosY draw. Do always divisible by 8. *8, *16, *24</param> public void DrawBar(SpriteBatch spriteBatch, SurvivariaPlayer player, Texture2D _texture, int divideBy, int frameFormula, float drawPosX = 1, float drawPosY = 1) { Texture2D texture = _texture; int frameHeight = texture.Height / divideBy; int frame = frameFormula; _drawPosition = new Vector2(backPanel.Left.Pixels - PaddingX * drawPosX, backPanel.Top.Pixels - PaddingY * drawPosY); Rectangle sourceRectangle = new Rectangle(0, frameHeight * frame, texture.Width, frameHeight); spriteBatch.Draw(texture, _drawPosition, sourceRectangle, Color.White); }
public override void UpdateEquip(Player player) { SurvivariaPlayer modPlayer = player.GetModPlayer <SurvivariaPlayer>(); modPlayer.HydrolyzerCrystals = true; }
public override void UpdateEquip(Player player) { SurvivariaPlayer modPlayer = player.GetModPlayer <SurvivariaPlayer>(); modPlayer.BloodAnalyzer = true; }
protected override void DrawSelf(SpriteBatch spriteBatch) { SurvivariaPlayer player = Main.LocalPlayer.GetModPlayer <SurvivariaPlayer>(); Vector2 mousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); if (!locationInitialized) { if (player.MenuOffset == Vector2.Zero) { backPanel.Left.Set(Main.screenWidth / 2f - backPanel.Width.Pixels / 2f, 0f); backPanel.Top.Set(Main.screenHeight / 12f, 0f); } else { backPanel.Left.Set(player.MenuOffset.X, 0f); backPanel.Top.Set(player.MenuOffset.Y, 0f); } Recalculate(); locationInitialized = true; } if (backPanel.ContainsPoint(mousePosition)) { Main.LocalPlayer.mouseInterface = true; } if (dragging) { backPanel.Left.Set(mousePosition.X - _offset.X, 0f); backPanel.Top.Set(mousePosition.Y - _offset.Y, 0f); player.MenuOffset = new Vector2(backPanel.Left.Pixels, backPanel.Top.Pixels); Recalculate(); } if (backPanel.Left.Pixels > Main.screenWidth) { backPanel.Left.Set(Main.screenWidth / 2f - backPanel.Width.Pixels / 2f, 0f); } //if (mod.GetConfig<SurvivariaConfigServer>().SanityEnabled) //DrawBar(spriteBatch, player, GFX.sanityIndicatorTexture, 5, (int)(player.CurrentSanity / player.MaximumSanity * 100 / 21), 1, 10); if (ModContent.GetInstance <SurvivariaConfigServer>().HungerEnabled) { DrawBar(spriteBatch, player, GFX.hungerIndicatorTexture, 8, (int)(player.CurrentHunger / player.HungerMaximum * 100 / 13 * 1.04 - 0.01)); if (player.BloodAnalyzer) { DrawBarText(spriteBatch, "" + (int)player.CurrentHunger, new Color(255, 153, 51), player, 0.7f, 4.4f, 0.3f); } } if (ModContent.GetInstance <SurvivariaConfigServer>().ThirstEnabled) { if (player.BloodAnalyzer) { DrawBar(spriteBatch, player, GFX.thirstIndicatorTexture, 5, (int)(player.CurrentThirst / player.MaximumThirst * 100 / 21), 1.6f, 7); } else { DrawBar(spriteBatch, player, GFX.thirstIndicatorTexture, 5, (int)(player.CurrentThirst / player.MaximumThirst * 100 / 21), 1.6f, 5); } if (player.HydrolyzerCrystals) { if (player.BloodAnalyzer) { DrawBarText(spriteBatch, "" + (int)player.CurrentThirst, Color.LightBlue, player, 1.3f, 11.4f, 0.3f); } else { DrawBarText(spriteBatch, "" + (int)player.CurrentThirst, Color.LightBlue, player, 1.3f, 9.4f, 0.3f); } } } //if (mod.GetConfig<SurvivariaConfigServer>().TemperatureEnabled) //DrawTemperatureFill(spriteBatch, player, -0.4f, 14.5f); }
public override void Update(GameTime gameTime) { Player player = Main.LocalPlayer; SurvivariaPlayer modPlayer = player.GetModPlayer <SurvivariaPlayer>(); changeTimer++; changeTimer2++; if (delayedTemperature < modPlayer.CurrentTemperature && changeTimer > 8) { delayedTemperature++; changeTimer = 0; } if (delayedTemperature > modPlayer.CurrentTemperature && changeTimer > 8) { delayedTemperature--; changeTimer = 0; } int temp24 = (int)modPlayer.CurrentTemperature - 24; if (changeTimer2 > 8) { RCol = ((250 + temp24 * 4 - Math.Abs(temp24) * 4) + RCol * 32) / 33; GCol = ((250 - Math.Abs(temp24) * 3) + GCol * 32) / 33; BCol = ((250 - temp24 * 4 - Math.Abs(temp24 * 4) + BCol * 32) / 33); changeTimer2 = 0; } displayRCol = (RCol + displayRCol) / 2; displayGCol = (GCol + displayGCol) / 2; displayBCol = (BCol + displayBCol) / 2; /*changeTimer2++; * if (modPlayer.CurrentTemperature < 24) * { * if (changeTimer2 > 6) * { * if (colorDifferenceRed != 0) * colorDifferenceRed--; * colorDifferenceBlue--; * changeTimer2 = 0; * } * * } * if (modPlayer.CurrentTemperature > 24) * { * if (changeTimer2 > 12) * { * if (colorDifferenceBlue != 0) * colorDifferenceBlue++; * colorDifferenceRed++; * changeTimer2 = 0; * } * } * else if (modPlayer.CurrentTemperature == 24) * { * colorDifferenceBlue = 0; * colorDifferenceRed = 0; * }*/ //insideColor = new Color(224 + colorDifferenceBlue * 3, 224 + colorDifferenceBlue * 3 - colorDifferenceRed * 3, 224 - colorDifferenceRed * 3); insideColor = new Color(displayRCol, displayGCol, displayBCol); //Main.NewText("The inside colors are: " + "R: " + insideColor.R + " " + "G: " + insideColor.G + " " + "B: " + insideColor.B); //Main.NewText("The blue color difference is: " + colorDifferenceBlue); //Main.NewText("The red color difference is: " + colorDifferenceRed); base.Update(gameTime); }
public void DrawTemperatureText(SpriteBatch spriteBatch, SurvivariaPlayer player, float drawPosX = 1f, float drawPosY = 1f) { _drawPosition = new Vector2(backPanel.Left.Pixels - PaddingX * drawPosX, backPanel.Top.Pixels - PaddingY * drawPosY); spriteBatch.DrawString(Main.fontDeathText, delayedTemperature + "°", _drawPosition, Color.Black, 0, new Vector2(0, 0), 0.4f, SpriteEffects.None, 1); }
public void DrawTemperatureFill(SpriteBatch spriteBatch, SurvivariaPlayer player, float drawPosX = 1f, float drawPosY = 1f) { _drawPosition = new Vector2(backPanel.Left.Pixels - PaddingX * drawPosX, backPanel.Top.Pixels - PaddingY * drawPosY); spriteBatch.Draw(GFX.temperatureFillTexture, _drawPosition, insideColor); DrawTemperatureIndicator(spriteBatch, player, drawPosX, drawPosY); }
public void DrawTemperatureIndicator(SpriteBatch spriteBatch, SurvivariaPlayer player, float drawPosX = 1f, float drawPosY = 1f) { _drawPosition = new Vector2(backPanel.Left.Pixels - PaddingX * drawPosX, backPanel.Top.Pixels - PaddingY * drawPosY); spriteBatch.Draw(GFX.temperatureBorderTexture, _drawPosition, Color.White); DrawTemperatureText(spriteBatch, player, drawPosX * -1.4f, drawPosY * 1.15f); }
public void DrawBarText(SpriteBatch spriteBatch, string text, Color color, SurvivariaPlayer player, float drawPosX = 1, float drawPosY = 1, float scale = 1f) { _drawPosition = new Vector2(backPanel.Left.Pixels - PaddingX * drawPosX, backPanel.Top.Pixels - PaddingY * drawPosY); spriteBatch.DrawString(Main.fontDeathText, text, _drawPosition, color, 0, new Vector2(0, 0), scale, SpriteEffects.None, 1); }
public override void UpdateEquip(Player player) { SurvivariaPlayer modPlayer = player.GetModPlayer <SurvivariaPlayer>(); modPlayer.ThirstLossMulti -= 0.15f; }