private void HandleConnect(MouseOverInteractable interactable) { if (ImprovedMouse.DidJustRightClick && !GameState.GameOver) { if (interactable.Type == InteractableType.Node) { startConnection = interactable.Entity; if (IsAlive(startConnection)) { var connectionLine = new ConnectionLine(startConnection, this); Parent.Add(connectionLine); connecting = connectionLine; } } SetTexture("handclick"); } if (IsConnecting && ImprovedMouse.DidJustRightRelease) { if (interactable.Type == InteractableType.Node && CanConnect(connecting, startConnection, interactable.Entity)) { connecting.Connected(startConnection, interactable.Entity); ConnectionHelper.RealignAllConnections(); } else { Parent.Remove(connecting); } SetTexture("hand"); connecting = null; } }
private void HandleDisconnect(MouseOverInteractable interactable) { if (interactable.Type != InteractableType.Connection || GameState.GameOver) { return; } if (ImprovedMouse.DidJustRightClick) { SetTexture("handclick"); } (interactable.Entity as ConnectionLine).IsHoveringOver = true; if (ImprovedMouse.DidJustRightRelease) { Parent.Remove(interactable.Entity); ConnectionHelper.RealignAllConnections(); SetTexture("hand"); } }
private void HandleCarry(MouseOverInteractable interactable) { if (ImprovedMouse.DidJustLeftClick) { if (interactable.Type == InteractableType.Node) { carrying = interactable.Entity; carryOffset = carrying.Position - Position; } SetTexture("handcarry"); } if (ImprovedMouse.DidJustLeftRelease) { carrying = null; SetTexture("hand"); } if (IsCarrying && !GameState.GameOver) { carrying.LocalPosition = Position + carryOffset; } }