Knot3.Game.Input.EdgeMovement.MovePipes C# (CSharp) Method

MovePipes() private method

Bestimme die Richtung und die Länge in Rasterpunkt-Einheiten und verschiebe die ausgewählten Kanten.
private MovePipes ( Vector3 currentMousePosition, Direction direction, GameTime time ) : void
currentMousePosition Vector3
direction Direction
time Microsoft.Xna.Framework.GameTime
return void
        private void MovePipes(Vector3 currentMousePosition, Direction direction, GameTime time)
        {
            int distance = (int)Math.Round (ComputeLength (currentMousePosition));
            if (distance > 0) {
                try {
                    Knot newKnot;
                    if (knotCache.ContainsKey (direction * distance)) {
                        newKnot = knotCache [direction * distance];
                    }
                    else {
                        Knot.TryMove (direction, distance, out newKnot);
                        knotCache [direction * distance] = newKnot;
                    }

                    if (newKnot != null) {
                        KnotMoved (newKnot);
                        Screen.AudioManager.PlaySound (Knot3Sound.PipeMoveSound);
                    }
                    else {
                        KnotMoved (Knot);
                        Screen.AudioManager.PlaySound (Knot3Sound.PipeInvalidMoveSound);
                    }
                    previousMousePosition = currentMousePosition;
                }
                catch (ArgumentOutOfRangeException exp) {
                    Log.Debug (exp);
                }
            }
            knotCache.Clear ();
        }

Same methods

EdgeMovement::MovePipes ( Vector3 currentMousePosition, GameTime time ) : void