This commit is contained in:
Chris Forbes
2009-11-10 20:43:55 +13:00
parent abac3bd59d
commit 9693593998
9 changed files with 77 additions and 16 deletions

View File

@@ -11,7 +11,7 @@ namespace OpenRa.Game
interface IEffect
{
void Tick();
IEnumerable<Pair<Sprite, float2>> Render();
IEnumerable<Tuple<Sprite, float2, int>> Render();
Player Owner { get; }
}
@@ -94,16 +94,32 @@ namespace OpenRa.Game
foreach (var victim in hitActors)
victim.InflictDamage(FiredBy, this, (int)GetDamageToInflict(victim));
}
}
}
const float height = .1f;
public IEnumerable<Pair<Sprite, float2>> Render()
public IEnumerable<Tuple<Sprite, float2, int>> Render()
{
if (anim != null)
yield return Pair.New(anim.Image,
float2.Lerp(
{
var pos = float2.Lerp(
Src.ToFloat2(),
VisualDest.ToFloat2(),
(float)t / TotalTime()) - 0.5f * anim.Image.size);
(float)t / TotalTime()) - 0.5f * anim.Image.size;
if (Projectile.High || Projectile.Arcing)
{
if (Projectile.Shadow)
yield return Tuple.New(anim.Image, pos, 8); /* todo: shadow pal */
var at = (float)t / TotalTime();
var highPos = pos - new float2(0, (VisualDest - Src).Length * height * 4 * at * (1 - at));
yield return Tuple.New(anim.Image, highPos, Owner.Palette);
}
else
yield return Tuple.New(anim.Image, pos, Owner.Palette);
}
}
float GetMaximumSpread()