fix 704 -- parachute offsets are configurable, and sensible now for infantry

This commit is contained in:
Chris Forbes
2011-05-14 11:31:48 +12:00
parent b792d07c8c
commit d8ff3b8d3a
4 changed files with 36 additions and 2 deletions

View File

@@ -25,6 +25,7 @@ namespace OpenRA.Mods.RA.Effects
readonly Actor cargo;
int2 offset;
float altitude;
const float fallRate = .3f;
@@ -44,9 +45,13 @@ namespace OpenRA.Mods.RA.Effects
else
anim.PlayFetchIndex("stand", () => 0);
anim.Tick();
var pai = cargo.Info.Traits.GetOrDefault<ParachuteAttachmentInfo>();
paraAnim = new Animation("parach");
paraAnim = new Animation(pai != null ? pai.ParachuteSprite : "parach");
paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle"));
if (pai != null) offset = pai.Offset;
}
public void Tick(World world)
@@ -71,7 +76,7 @@ namespace OpenRA.Mods.RA.Effects
var pos = location - new float2(0, altitude);
yield return new Renderable(anim.Image, location - .5f * anim.Image.size, "shadow", 0);
yield return new Renderable(anim.Image, pos - .5f * anim.Image.size, palette, 2);
yield return new Renderable(paraAnim.Image, pos - .5f * paraAnim.Image.size, palette, 3);
yield return new Renderable(paraAnim.Image, pos - .5f * paraAnim.Image.size + offset, palette, 3);
}
}
}

View File

@@ -346,6 +346,7 @@
<Compile Include="Captures.cs" />
<Compile Include="Activities\CaptureActor.cs" />
<Compile Include="InvisibleToEnemy.cs" />
<Compile Include="ParachuteAttachment.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -0,0 +1,26 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 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;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class ParachuteAttachmentInfo : TraitInfo<ParachuteAttachment>
{
public readonly string ParachuteSprite = "parach";
public readonly int2 Offset = new int2(0,0);
}
class ParachuteAttachment {}
}

View File

@@ -102,6 +102,8 @@
GivesBounty:
GpsDot:
String:Infantry
ParachuteAttachment:
Offset: 0,-10
^Ship:
AppearsOnRadar: