public override void OnStateUndock(Actor self) { // If dock animation hasn't played, we didn't actually dock and have to skip the undock anim and notification if (!dockAnimPlayed) { dockingState = DockingState.Complete; return; } dockingState = DockingState.Wait; wsb.PlayCustomAnimationBackwards(self, wda.DockSequence, () => { dockingState = DockingState.Complete; foreach (var trait in self.TraitsImplementing <INotifyHarvesterAction>()) { trait.Undocked(); } if (Refinery.IsInWorld && !Refinery.IsDead) { foreach (var nd in Refinery.TraitsImplementing <INotifyDocking>()) { nd.Undocked(Refinery, self); } } }); }
public override void OnStateDock(Actor self) { body.Docked = true; foreach (var trait in self.TraitsImplementing <INotifyHarvesterAction>()) { trait.Docked(); } foreach (var nd in Refinery.TraitsImplementing <INotifyDocking>()) { nd.Docked(Refinery, self); } if (spriteOverlay != null && !spriteOverlay.Visible) { spriteOverlay.Visible = true; spriteOverlay.WithOffset.Animation.PlayThen(spriteOverlay.Info.Sequence, () => { dockingState = DockingState.Loop; spriteOverlay.Visible = false; }); } else { dockingState = DockingState.Loop; } }
public override void OnStateUndock(Actor self) { // If body.Docked wasn't set, we didn't actually dock and have to skip the undock overlay if (!body.Docked) { dockingState = DockingState.Complete; } else if (Refinery.IsInWorld && !Refinery.IsDead && spriteOverlay != null && !spriteOverlay.Visible) { dockingState = DockingState.Wait; spriteOverlay.Visible = true; spriteOverlay.WithOffset.Animation.PlayBackwardsThen(spriteOverlay.Info.Sequence, () => { dockingState = DockingState.Complete; body.Docked = false; spriteOverlay.Visible = false; foreach (var trait in self.TraitsImplementing <INotifyHarvesterAction>()) { trait.Undocked(); } if (Refinery.IsInWorld && !Refinery.IsDead) { foreach (var nd in Refinery.TraitsImplementing <INotifyDocking>()) { nd.Undocked(Refinery, self); } } }); } else { dockingState = DockingState.Complete; body.Docked = false; foreach (var trait in self.TraitsImplementing <INotifyHarvesterAction>()) { trait.Undocked(); } if (Refinery.IsInWorld && !Refinery.IsDead) { foreach (var nd in Refinery.TraitsImplementing <INotifyDocking>()) { nd.Undocked(Refinery, self); } } } }
public override void OnStateDock(Actor self) { foreach (var trait in self.TraitsImplementing <INotifyHarvesterAction>()) { trait.Docked(); } foreach (var nd in Refinery.TraitsImplementing <INotifyDocking>()) { nd.Docked(Refinery, self); } wsb.PlayCustomAnimation(self, wda.DockSequence, () => wsb.PlayCustomAnimationRepeating(self, wda.DockLoopSequence)); dockAnimPlayed = true; dockingState = DockingState.Loop; }