add burning

This commit is contained in:
Chris Forbes
2010-05-16 15:15:09 +12:00
parent 67d741e671
commit 7c244df5d1
4 changed files with 54 additions and 1 deletions

42
OpenRA.Mods.RA/Burns.cs Normal file
View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRA.Traits;
using OpenRA.Graphics;
namespace OpenRA.Mods.RA
{
class BurnsInfo : TraitInfo<Burns>
{
public readonly string Anim = "1";
public readonly int Damage = 1;
public readonly int Interval = 8;
}
class Burns : ITick
{
[Sync]
int ticks;
bool isSetup;
public void Tick(Actor self)
{
if (!isSetup)
{
isSetup = true;
var anim = new Animation("fire", () => 0);
anim.PlayRepeating(self.Info.Traits.Get<BurnsInfo>().Anim);
self.traits.Get<RenderSimple>().anims.Add("fire",
new RenderSimple.AnimationWithOffset(anim, () => new float2(0, -3), null));
}
if (--ticks <= 0)
{
self.InflictDamage(self, self.Info.Traits.Get<BurnsInfo>().Damage, null);
ticks = self.Info.Traits.Get<BurnsInfo>().Interval;
}
}
}
}

View File

@@ -54,6 +54,7 @@
<Compile Include="Activities\Steal.cs" />
<Compile Include="Activities\Teleport.cs" />
<Compile Include="AirstrikePower.cs" />
<Compile Include="Burns.cs" />
<Compile Include="C4Demolition.cs" />
<Compile Include="CarpetBomb.cs" />
<Compile Include="Chronoshiftable.cs" />

View File

@@ -924,4 +924,10 @@
<sequence name="open" start="0" length="60" tick="120" src="playersmoke" />
<sequence name="idle" start="60" length="32" tick="120" src="playersmoke" />
</unit>
<unit name="fire">
<sequence name="1" start="0" length="15" src="fire1" />
<sequence name="2" start="0" length="15" src="fire2" />
<sequence name="3" start="0" length="15" src="fire3" />
<sequence name="4" start="0" length="15" src="fire4" />
</unit>
</sequences>

View File

@@ -679,6 +679,7 @@ U2:
Spread: 3,3
Speed: 6
AnimKey: turret
Burns:
2TNK.Husk:
Inherits: ^Vehicle
@@ -697,6 +698,7 @@ U2:
Spread: 3,3
Speed: 6
AnimKey: turret
Burns:
3TNK.Husk:
Inherits: ^Vehicle
@@ -715,6 +717,7 @@ U2:
Spread: 3,3
Speed: 6
AnimKey: turret
Burns:
4TNK.Husk:
Inherits: ^Vehicle
@@ -732,4 +735,5 @@ U2:
Anim: turret
Spread: 3,3
Speed: 6
AnimKey: turret
AnimKey: turret
Burns: