configurable and self-documenting idle sequence name
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* 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
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -15,21 +15,24 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA.Render
|
namespace OpenRA.Mods.RA.Render
|
||||||
{
|
{
|
||||||
|
[Desc("Also returns a default selection size that is calculated automatically from the voxel dimensions.")]
|
||||||
public class WithVoxelBodyInfo : ITraitInfo, Requires<RenderVoxelsInfo>
|
public class WithVoxelBodyInfo : ITraitInfo, Requires<RenderVoxelsInfo>
|
||||||
{
|
{
|
||||||
public object Create(ActorInitializer init) { return new WithVoxelBody(init.self); }
|
public readonly string Sequence = "idle";
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new WithVoxelBody(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithVoxelBody : IAutoSelectionSize
|
public class WithVoxelBody : IAutoSelectionSize
|
||||||
{
|
{
|
||||||
int2 size;
|
int2 size;
|
||||||
|
|
||||||
public WithVoxelBody(Actor self)
|
public WithVoxelBody(Actor self, WithVoxelBodyInfo info)
|
||||||
{
|
{
|
||||||
var body = self.Trait<IBodyOrientation>();
|
var body = self.Trait<IBodyOrientation>();
|
||||||
var rv = self.Trait<RenderVoxels>();
|
var rv = self.Trait<RenderVoxels>();
|
||||||
|
|
||||||
var voxel = VoxelProvider.GetVoxel(rv.Image, "idle");
|
var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence);
|
||||||
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
|
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
|
||||||
() => new[]{ body.QuantizeOrientation(self, self.Orientation) },
|
() => new[]{ body.QuantizeOrientation(self, self.Orientation) },
|
||||||
() => false, () => 0));
|
() => false, () => 0));
|
||||||
|
|||||||
Reference in New Issue
Block a user