Progress bars that show the health of wall sections when welding/cutting

This commit is contained in:
Regalis
2016-09-20 18:40:30 +03:00
parent f8368f464a
commit 5918e845ac
7 changed files with 140 additions and 41 deletions
@@ -7,7 +7,7 @@ using System.Xml.Linq;
namespace Barotrauma.Items.Components
{
class Pickable : ItemComponent, IDrawableComponent
class Pickable : ItemComponent
{
protected Character picker;
@@ -125,6 +125,13 @@ namespace Barotrauma.Items.Components
yield return CoroutineStatus.Success;
}
picker.UpdateHUDProgressBar(
this,
item.WorldPosition,
pickTimer / requiredTime,
Color.Red, Color.Green);
picker.AnimController.Anim = AnimController.Animation.UsingConstruction;
picker.AnimController.TargetMovement = Vector2.Zero;
@@ -175,23 +182,7 @@ namespace Barotrauma.Items.Components
}
}
}
public void Draw(SpriteBatch spriteBatch, bool editing = false)
{
if (pickTimer <= 0.0f)
{
Drawable = false;
return;
}
float progressBarWidth = 100.0f;
GUI.DrawProgressBar(spriteBatch, item.DrawPosition + new Vector2(-progressBarWidth/2.0f, 50.0f), new Vector2(progressBarWidth, 15.0f),
pickTimer / PickingTime,
Color.Lerp(Color.Red, Color.Green, pickTimer / PickingTime));
}
public override void Drop(Character dropper)
{
if (picker == null)