public override Activity Tick(Actor self) { if (!target.IsValidFor(self)) { Cancel(self); } if (IsCanceled) { return(NextActivity); } var plane = self.Trait <Plane>(); var d = target.CenterPosition - self.CenterPosition; // The next move would overshoot, so just set the final position var move = plane.FlyStep(plane.Facing); if (d.HorizontalLengthSquared < move.HorizontalLengthSquared) { plane.SetPosition(self, target.CenterPosition); return(NextActivity); } var desiredFacing = Util.GetFacing(d, plane.Facing); Fly.FlyToward(self, plane, desiredFacing, WRange.Zero); return(this); }
public override Activity Tick(Actor self) { if (IsCanceled || !self.World.Map.IsInMap(self.Location)) { return(NextActivity); } var plane = self.Trait <Plane>(); Fly.FlyToward(self, plane, plane.Facing, plane.Info.CruiseAltitude); return(this); }
public override Activity Tick(Actor self) { if (IsCanceled || remainingTicks-- == 0) { return(NextActivity); } var plane = self.Trait <Plane>(); Fly.FlyToward(self, plane, plane.Facing, plane.Info.CruiseAltitude); return(this); }
public override Activity Tick(Actor self) { if (IsCanceled) { return(NextActivity); } var plane = self.Trait <Plane>(); // We can't possibly turn this fast var desiredFacing = plane.Facing + 64; Fly.FlyToward(self, plane, desiredFacing, plane.Info.CruiseAltitude); return(this); }