fix missing prereq on GainsExperience; List -> array; float -> int

This commit is contained in:
Chris Forbes
2010-05-27 18:35:44 +12:00
parent 0c8e8b5658
commit 294240de7f

View File

@@ -26,7 +26,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
public class GainsExperienceInfo : ITraitInfo public class GainsExperienceInfo : ITraitInfo, ITraitPrerequisite<ValuedInfo>
{ {
//public readonly float[] CostThreshold = {2,4,8}; //public readonly float[] CostThreshold = {2,4,8};
public readonly float[] CostThreshold = { 1, 1.5f, 2 }; public readonly float[] CostThreshold = { 1, 1.5f, 2 };
@@ -39,14 +39,15 @@ namespace OpenRA.Mods.RA
public class GainsExperience : IFirepowerModifier, ISpeedModifier, IDamageModifier public class GainsExperience : IFirepowerModifier, ISpeedModifier, IDamageModifier
{ {
readonly Actor self; readonly Actor self;
readonly List<float> Levels; readonly int[] Levels;
readonly GainsExperienceInfo Info; readonly GainsExperienceInfo Info;
public GainsExperience(Actor self, GainsExperienceInfo info) public GainsExperience(Actor self, GainsExperienceInfo info)
{ {
this.self = self; this.self = self;
this.Info = info; this.Info = info;
var cost = self.Info.Traits.Get<ValuedInfo>().Cost; var cost = self.Info.Traits.Get<ValuedInfo>().Cost;
Levels = Info.CostThreshold.Select(t => t * cost).ToList(); Levels = Info.CostThreshold.Select(t => (int)(t * cost)).ToArray();
} }
[Sync] [Sync]