Move EnterBehaviour behaviour to Enter.

This commit is contained in:
Paul Chote
2015-12-30 19:50:26 +00:00
parent a580aa1f27
commit f5fafb1b9d
8 changed files with 16 additions and 16 deletions

View File

@@ -24,7 +24,9 @@ namespace OpenRA.Mods.Common.Activities
readonly IMove move;
readonly int maxTries = 0;
readonly EnterBehaviour enterBehaviour;
readonly bool targetCenter;
public Target Target { get { return target; } }
Target target;
State nextState = State.ApproachingOrEntering; // Hint/starting point for next state
@@ -33,11 +35,12 @@ namespace OpenRA.Mods.Common.Activities
Activity inner;
bool firstApproach = true;
protected Enter(Actor self, Actor target, int maxTries = 1, bool targetCenter = false)
protected Enter(Actor self, Actor target, EnterBehaviour enterBehaviour, int maxTries = 1, bool targetCenter = false)
{
this.move = self.Trait<IMove>();
this.target = Target.FromActor(target);
this.maxTries = maxTries;
this.enterBehaviour = enterBehaviour;
this.targetCenter = targetCenter;
}
@@ -215,6 +218,11 @@ namespace OpenRA.Mods.Common.Activities
OnInside(self);
if (enterBehaviour == EnterBehaviour.Suicide)
self.Kill(self);
else if (enterBehaviour == EnterBehaviour.Dispose)
self.Dispose();
// Return if Abort(Actor) or Done(self) was called from OnInside.
if (nextState >= State.Exiting)
return State.Inside;