add the Hovercraft wake animation
This commit is contained in:
@@ -366,6 +366,7 @@
|
||||
<Compile Include="Traits\ProximityCapturable.cs" />
|
||||
<Compile Include="Traits\RadarColorFromTerrain.cs" />
|
||||
<Compile Include="Traits\Render\Hovers.cs" />
|
||||
<Compile Include="Traits\Render\LeavesTrails.cs" />
|
||||
<Compile Include="Traits\Render\RenderBuilding.cs" />
|
||||
<Compile Include="Traits\Render\RenderBuildingCharge.cs" />
|
||||
<Compile Include="Traits\Render\RenderBuildingTurreted.cs" />
|
||||
|
||||
53
OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs
Normal file
53
OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2015 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 COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("Renders a sprite effect when leaving a cell.")]
|
||||
public class LeavesTrailsInfo : ITraitInfo
|
||||
{
|
||||
public readonly string Image = null;
|
||||
public readonly string Palette = "effect";
|
||||
|
||||
[Desc("Only do so when the terrain types match with the previous cell.")]
|
||||
public readonly string[] TerrainTypes = { };
|
||||
|
||||
public object Create(ActorInitializer init) { return new LeavesTrails(this, init.Self); }
|
||||
}
|
||||
|
||||
public class LeavesTrails : ITick
|
||||
{
|
||||
readonly LeavesTrailsInfo info;
|
||||
|
||||
public LeavesTrails(LeavesTrailsInfo info, Actor self)
|
||||
{
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
CPos cachedLocation;
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (cachedLocation != self.Location)
|
||||
{
|
||||
var type = self.World.Map.GetTerrainInfo(cachedLocation).Type;
|
||||
var pos = self.World.Map.CenterOfCell(cachedLocation);
|
||||
if (info.TerrainTypes.Contains(type) && !string.IsNullOrEmpty(info.Image))
|
||||
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, self.World, info.Image, info.Palette)));
|
||||
|
||||
cachedLocation = self.Location;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,10 @@ HVR:
|
||||
WithVoxelBody:
|
||||
WithVoxelTurret:
|
||||
Hovers:
|
||||
LeavesTrails:
|
||||
Image: wake
|
||||
Palette: effect
|
||||
TerrainTypes: Water
|
||||
|
||||
SMECH:
|
||||
Inherits: ^Tank
|
||||
|
||||
@@ -220,6 +220,11 @@ moveflsh:
|
||||
Length: *
|
||||
Tick: 30
|
||||
|
||||
wake:
|
||||
idle: wake2
|
||||
Length: *
|
||||
Tick: 180
|
||||
|
||||
resources:
|
||||
Defaults:
|
||||
UseTilesetExtension: true
|
||||
|
||||
Reference in New Issue
Block a user