public override Activity Tick(Actor self) { switch (state) { case State.Wait: return(this); case State.Turn: state = State.Dock; return(Util.SequenceActivities(new Turn(64), this)); case State.Dock: ru.PlayCustomAnimation(self, "dock", () => { ru.PlayCustomAnimRepeating(self, "dock-loop"); state = State.Loop; }); state = State.Wait; return(this); case State.Loop: if (harv.TickUnload(self, proc)) { state = State.Undock; } return(this); case State.Undock: ru.PlayCustomAnimBackwards(self, "dock", () => state = State.Complete); state = State.Wait; return(this); case State.Complete: harv.LastLinkedProc = harv.LinkedProc; harv.LinkProc(self, null); return(NextActivity); } throw new InvalidOperationException("Invalid harvester dock state"); }
public override Activity Tick(Actor self) { switch (state) { case State.Wait: return(this); case State.Turn: state = State.Dock; return(Util.SequenceActivities(new Turn(angle), this)); case State.Dock: ru.PlayCustomAnimation(self, "dock", () => { ru.PlayCustomAnimRepeating(self, "dock-loop"); if (proc.IsInWorld && !proc.IsDead()) { foreach (var nd in proc.TraitsImplementing <INotifyDocking>()) { nd.Docked(proc, self); } } state = State.Loop; }); state = State.Wait; return(this); case State.Loop: if (!proc.IsInWorld || proc.IsDead() || harv.TickUnload(self, proc)) { state = State.Undock; } return(this); case State.Undock: ru.PlayCustomAnimBackwards(self, "dock", () => state = State.Complete); state = State.Wait; return(this); case State.Complete: harv.LastLinkedProc = harv.LinkedProc; harv.LinkProc(self, null); if (proc.IsInWorld && !proc.IsDead()) { foreach (var nd in proc.TraitsImplementing <INotifyDocking>()) { nd.Undocked(proc, self); } } return(NextActivity); } throw new InvalidOperationException("Invalid harvester dock state"); }