transformation can pass exp to new actor

This commit is contained in:
dnqbob
2020-03-10 09:30:37 +08:00
committed by atlimit8
parent 8f8747d65e
commit 09014ab6d5

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
public object Create(ActorInitializer init) { return new GainsExperience(init, this); } public object Create(ActorInitializer init) { return new GainsExperience(init, this); }
} }
public class GainsExperience : INotifyCreated, ISync, IResolveOrder public class GainsExperience : INotifyCreated, ISync, IResolveOrder, ITransformActorInitModifier
{ {
readonly Actor self; readonly Actor self;
readonly GainsExperienceInfo info; readonly GainsExperienceInfo info;
@@ -143,6 +143,11 @@ namespace OpenRA.Mods.Common.Traits
GiveLevels(1); GiveLevels(1);
} }
} }
void ITransformActorInitModifier.ModifyTransformActorInit(Actor self, TypeDictionary init)
{
init.Add(new ExperienceInit(experience));
}
} }
class ExperienceInit : IActorInit<int> class ExperienceInit : IActorInit<int>