add smoke trails for damaged aircraft

This commit is contained in:
Chris Forbes
2010-11-21 11:48:09 +13:00
parent b0e3364a77
commit 060d544390
3 changed files with 46 additions and 0 deletions

View File

@@ -60,6 +60,7 @@
<Compile Include="Activities\Demolish.cs" />
<Compile Include="Activities\Enter.cs" />
<Compile Include="Activities\EnterTransport.cs" />
<Compile Include="SmokeTrailWhenDamaged.cs" />
<Compile Include="Strategic\StrategicVictoryConditions.cs" />
<Compile Include="Strategic\StrategicPoint.cs" />
<Compile Include="ProximityCapturable.cs" />

View File

@@ -0,0 +1,31 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System;
using OpenRA.Traits;
using OpenRA.Mods.RA.Effects;
namespace OpenRA.Mods.RA
{
class SmokeTrailWhenDamagedInfo : TraitInfo<SmokeTrailWhenDamaged> { }
class SmokeTrailWhenDamaged : ITick
{
public void Tick(Actor self)
{
if (self.GetDamageState() >= DamageState.Heavy)
self.World.AddFrameEndTask(
w => { if (!self.Destroyed) w.Add(
new Smoke(w, self.CenterLocation.ToInt2()
- new int2(0, self.Trait<IMove>().Altitude),
"smokey")); });
}
}
}