public void Update() { //Note: If the actor is pushed during this compound action, it will automatically warp back to the path. We should handle interruptions where the actor is attacked if (action?.Done() != false) { if (points.Count == 0) { return; } //Make a new action if (points.Count > 0) { //Truncate to integer coordinates so that we don't get confused by floats action = new WalkAction(actor, points.First.Value.i - actor.Position.i); points.RemoveFirst(); } } else { action.Update(); } }
public bool Done() => points.Count == 0 && (action == null || action.Done());