public override Activity Tick(Actor self) { if (IsCanceled) { return(NextActivity); } var info = self.Info.Traits.Get <HelicopterInfo>(); var aircraft = self.Trait <Aircraft>(); if (aircraft.Altitude != info.CruiseAltitude) { aircraft.Altitude += Math.Sign(info.CruiseAltitude - aircraft.Altitude); return(this); } var dist = Dest - aircraft.PxPosition; if (float2.WithinEpsilon(float2.Zero, dist.ToFloat2(), 2)) { aircraft.SubPxPosition = Dest.ToPSubPos(); return(NextActivity); } var desiredFacing = Util.GetFacing(dist, aircraft.Facing); aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT); aircraft.TickMove(PSubPos.PerPx * aircraft.MovementSpeed, desiredFacing); return(this); }
public void SetPxPosition(Actor self, PPos px) { SubPxPosition = px.ToPSubPos(); }