Added IRangeMultiplier

This commit is contained in:
atlimit8
2015-06-27 13:52:00 -05:00
parent 65c1d2f5c1
commit 74a9dc6793
14 changed files with 96 additions and 23 deletions

View File

@@ -0,0 +1,37 @@
#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;
using System.Linq;
using OpenRA;
using OpenRA.GameRules;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Range of this actor is multiplied based on upgrade level.")]
public class RangeMultiplierInfo : UpgradeMultiplierTraitInfo, IRangeModifierInfo
{
public override object Create(ActorInitializer init) { return new RangeMultiplier(this, init.Self.Info.Name); }
public int GetRangeModifierDefault()
{
return BaseLevel > 0 || UpgradeTypes.Length == 0 ? 100 : Modifier[0];
}
}
public class RangeMultiplier : UpgradeMultiplierTrait, IRangeModifier
{
public RangeMultiplier(RangeMultiplierInfo info, string actorType)
: base(info, "RangeMultiplier", actorType) { }
public int GetRangeModifier() { return GetModifier(); }
}
}