Adds damage debug overlay

This commit is contained in:
DeadlySurprise
2014-09-03 14:17:50 +02:00
parent 8e4b5af352
commit 7183c52a2e
11 changed files with 38 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
#region Copyright & License Information
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
@@ -17,23 +17,24 @@ using OpenRA.Mods.RA.Graphics;
namespace OpenRA.Mods.RA.Effects
{
class CashTick : IEffect
public class FloatingText : IEffect
{
readonly SpriteFont font;
readonly string text;
Color color;
int remaining = 30;
int remaining;
WPos pos;
public CashTick(WPos pos, Color color, int value)
public FloatingText(WPos pos, Color color, string text, int duration)
{
this.font = Game.Renderer.Fonts["TinyBold"];
this.pos = pos;
this.color = color;
this.text = "{0}${1}".F(value < 0 ? "-" : "+", Math.Abs(value));
this.text = text;
this.remaining = duration;
}
static readonly WVec velocity = new WVec(0,0,86);
static readonly WVec velocity = new WVec(0, 0, 86);
public void Tick(World world)
{
if (--remaining <= 0)
@@ -49,5 +50,10 @@ namespace OpenRA.Mods.RA.Effects
yield return new TextRenderable(font, pos, 0, color, text);
}
public static string FormatCashTick(int cashAmount)
{
return "{0}${1}".F(cashAmount < 0 ? "-" : "+", Math.Abs(cashAmount));
}
}
}