Simplify IDockHost interface

This commit is contained in:
Gustas
2024-08-29 19:57:06 +03:00
committed by Paul Chote
parent 1334575ba9
commit d24533d561
3 changed files with 19 additions and 30 deletions

View File

@@ -41,7 +41,8 @@ namespace OpenRA.Mods.Common.Activities
bool dockInitiated = false;
public GenericDockSequence(Actor self, DockClientManager client, Actor hostActor, IDockHost host)
public GenericDockSequence(Actor self, DockClientManager client, Actor hostActor, IDockHost host,
int dockWait, bool isDragRequired, WVec dragOffset, int dragLength)
{
dockingState = DockingState.Drag;
@@ -54,17 +55,12 @@ namespace OpenRA.Mods.Common.Activities
DockHostSpriteOverlay = hostActor.TraitOrDefault<WithDockingOverlay>();
notifyDockHosts = hostActor.TraitsImplementing<INotifyDockHost>().ToArray();
if (host is IDockHostDrag sequence)
{
IsDragRequired = sequence.IsDragRequired;
DragLength = sequence.DragLength;
StartDrag = self.CenterPosition;
EndDrag = hostActor.CenterPosition + sequence.DragOffset;
}
else
IsDragRequired = false;
IsDragRequired = isDragRequired;
DragLength = dragLength;
StartDrag = self.CenterPosition;
EndDrag = hostActor.CenterPosition + dragOffset;
QueueChild(new Wait(host.DockWait));
QueueChild(new Wait(dockWait));
}
public override bool Tick(Actor self)