#87 CNC buildings should show Critical anim while dying
This commit is contained in:
38
OpenRA.Mods.Cnc/CriticalBuildingState.cs
Normal file
38
OpenRA.Mods.Cnc/CriticalBuildingState.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Effects;
|
||||
|
||||
namespace OpenRA.Mods.Cnc
|
||||
{
|
||||
class CriticalBuildingStateInfo : ITraitInfo
|
||||
{
|
||||
public readonly int LingerTime = 20;
|
||||
public object Create(Actor self) { return new CriticalBuildingState(self, this); }
|
||||
}
|
||||
|
||||
class CriticalBuildingState : INotifyDamage
|
||||
{
|
||||
CriticalBuildingStateInfo info;
|
||||
|
||||
public CriticalBuildingState(Actor self, CriticalBuildingStateInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
self.RemoveOnDeath = false;
|
||||
}
|
||||
|
||||
public void Damaged(Actor self, AttackInfo e)
|
||||
{
|
||||
if (e.DamageStateChanged && e.DamageState == DamageState.Dead)
|
||||
{
|
||||
self.traits.Get<RenderSimple>().anim.PlayRepeating("critical-idle");
|
||||
self.World.AddFrameEndTask(
|
||||
w => w.Add(
|
||||
new DelayedAction(info.LingerTime,
|
||||
() => w.Remove(self))));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CriticalBuildingState.cs" />
|
||||
<Compile Include="Effects\IonCannon.cs" />
|
||||
<Compile Include="IonCannonPower.cs" />
|
||||
<Compile Include="ProductionAirdrop.cs" />
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
DamagedSound: xplos.aud
|
||||
DestroyedSound: xplobig4.aud
|
||||
RenderBuilding:
|
||||
CriticalBuildingState:
|
||||
|
||||
^Tree:
|
||||
Category: Building
|
||||
|
||||
@@ -37,8 +37,8 @@ Chrome:
|
||||
mods/cnc/chrome.xml:
|
||||
|
||||
Assemblies:
|
||||
mods/cnc/OpenRA.Mods.Cnc.dll: Cnc mod traits
|
||||
mods/ra/OpenRA.Mods.RA.dll: Red alert mod traits
|
||||
mods/cnc/OpenRA.Mods.Cnc.dll: Cnc mod traits
|
||||
|
||||
ChromeLayout:
|
||||
mods/cnc/menus.yaml:
|
||||
|
||||
@@ -42,7 +42,7 @@ IonCannon:
|
||||
Verses: 100%,100%,100%,100%,100%
|
||||
InfDeath: 4
|
||||
Warhead@area:
|
||||
DamageMode: PerCell
|
||||
DamageModel: PerCell
|
||||
Damage: 200
|
||||
SmudgeType: Scorch
|
||||
Size: 2,1
|
||||
|
||||
Reference in New Issue
Block a user