removed Mobile.InternalSetActivity

This commit is contained in:
Bob
2009-11-12 13:00:05 +13:00
parent 8325389d9f
commit a74050a3e6
10 changed files with 91 additions and 116 deletions

View File

@@ -18,24 +18,20 @@ namespace OpenRa.Game.Traits.Activities
public IActivity NextActivity { get; set; }
public void Tick(Actor self, Mobile mobile)
public IActivity Tick( Actor self, Mobile mobile )
{
if (Target.IsDead)
{
mobile.InternalSetActivity(NextActivity);
return;
}
if (Target == null || Target.IsDead)
return NextActivity;
if ((Target.Location - self.Location).LengthSquared >= Range * Range)
{
mobile.InternalSetActivity(new Move(Target, Range));
mobile.QueueActivity(this);
}
if( ( Target.Location - self.Location ).LengthSquared >= Range * Range )
return new Move( Target, Range ) { NextActivity = this };
return null;
}
public void Cancel(Actor self, Mobile mobile)
{
mobile.InternalSetActivity(null);
Target = null;
}
}
}