private void FireRotateEvent(Vector2 prev_diff_vector, Vector2 diff_vector, float angle) { Vector3 cross = Vector3.Cross(prev_diff_vector, diff_vector); RotationDirections dir = RotationDirections.CW; if (cross.z > 0) { dir = RotationDirections.CCW; //Debug.Log($"Rotate Counter CW {angle}"); } else if (cross.z < 0) { dir = RotationDirections.CW; //Debug.Log($"Rotate CW {angle}"); } Vector2 midPoint = GetMidPoint(trackedFinger1.position, trackedFinger2.position); GameObject hitObj = GetHit(midPoint); OnRotateEventArg args = new OnRotateEventArg(trackedFinger1, trackedFinger2, angle, dir, hitObj); if (OnRotate != null) { OnRotate(this, args); } if (hitObj != null) { IRotated rot = hitObj.GetComponent <IRotated>(); if (rot != null) { rot.OnRotate(args); } } }
public OnRotateEventArg(Touch f1, Touch f2, float a, RotationDirections dir, GameObject obj) { Finger1 = f1; Finger2 = f2; Angle = a; RotationDirection = dir; HitObject = obj; }
public override void OnTick(Controller controller) { //check how far have we rotated. float currentAngle = Vector2.Angle(m_startedDir, controller.transform.up); if (currentAngle > m_maxRotation) { /*[Tedo]: * can be refactored */ #region refactor target //swap directions if (m_direction == m_startDirection) { if (m_direction == RotationDirections.left) { m_direction = RotationDirections.right; } else { m_direction = RotationDirections.left; } } else { if (m_direction == RotationDirections.left) { m_direction = RotationDirections.right; } else { m_direction = RotationDirections.left; } /*[Tedo]: * Misleading name, maybe change it the name to m_currentCycle instead? */ ++m_currentRotation; } #endregion } else if (currentAngle <= 0.5f) { /*[Tedo]: * I don't think a state should be able to be 'finished' (Read 'StateFinishTransition.cs'). * I would limit the idle duration using TimeTransition instead of defining it in this state. * However, you may keep this method if you prefer it*/ if (m_direction == m_startDirection && m_currentRotation >= m_maxRotations) { isFinished = true; } } //ticks the state base.OnTick(controller); }
//----------------------------------------------------------------------------------------------------------------- //public API Methods //----------------------------------------------------------------------------------------------------------------- public override void OnEnter(Controller controller) { //save our starting direction m_startedDir = controller.transform.up; m_startedForward = controller.transform.forward; m_startedAngle = controller.transform.rotation.z; //reset the current rotation counter m_currentRotation = 0; //set our starting rotation m_direction = m_startDirection; //calls the state's OnEnter base.OnEnter(controller); }
public MID_0013(int parameterSetId, string parameterSetName, RotationDirections rotationDirection, int batchSize, decimal minTorque, decimal maxTorque, decimal torqueFinalTarget, int minAngle, int maxAngle, int angleFinalTarget) : base(length, MID, revision) { this.ParameterSetID = parameterSetId; this.ParameterSetName = parameterSetName; this.RotationDirection = rotationDirection; this.BatchSize = batchSize; this.MinTorque = minTorque; this.MaxTorque = maxTorque; this.TorqueFinalTarget = torqueFinalTarget; this.MinAngle = minAngle; this.MaxAngle = maxAngle; this.AngleFinalTarget = angleFinalTarget; }
private void FireRotateEvent(float angle, RotationDirections dir) { Vector2 midPoint = GetMidPoint(gesture_finger1.position, gesture_finger2.position); GameObject hitObj = GetHit(midPoint); RotateEventArgs args = new RotateEventArgs(gesture_finger1, gesture_finger2, angle, dir, hitObj); if (OnRotate != null) { OnRotate(this, args); } if (hitObj != null) { IRotate rot = hitObj.GetComponent <IRotate>(); if (rot != null) { rot.onRotate(args); } } }
public void Rotate() { // Store the current block position Point OldPosition1 = square1.Location; Point OldPosition2 = square2.Location; Point OldPosition3 = square3.Location; Point OldPosition4 = square4.Location; RotationDirections OldStatusRotation = StatusRotation; Hide(GameField.GraphBackground); // Rotate the blocks switch(BlockType) { case BlockTypes.Square: // Do nothing. Squares don't rotate. break; case BlockTypes.Line: // Rotate all squares around square 2 switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X+squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X+2*squareSize, square2.Location.Y); break; case RotationDirections.East: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square3.Location = new Point(square2.Location.X, square2.Location.Y+squareSize); square4.Location = new Point(square2.Location.X, square2.Location.Y+2*squareSize); break; } break; case BlockTypes.J: // Rotate all squares around square 3 switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square3.Location.X, square3.Location.Y-squareSize); square2.Location = new Point(square3.Location.X+squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X+2*squareSize, square3.Location.Y); break; case RotationDirections.East: StatusRotation = RotationDirections.South; square1.Location = new Point(square3.Location.X+squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X, square3.Location.Y+squareSize); square4.Location = new Point(square3.Location.X, square3.Location.Y+2*squareSize); break; case RotationDirections.South: StatusRotation = RotationDirections.West; square1.Location = new Point(square3.Location.X, square3.Location.Y+squareSize); square2.Location = new Point(square3.Location.X-squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X-2*squareSize, square3.Location.Y); break; case RotationDirections.West: StatusRotation = RotationDirections.North; square1.Location = new Point(square3.Location.X-squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X, square3.Location.Y-squareSize); square4.Location = new Point(square3.Location.X, square3.Location.Y-2*squareSize); break; } break; case BlockTypes.L: // Rotate all squares around square 3 switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square3.Location.X+squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X+2*squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X, square3.Location.Y+squareSize); break; case RotationDirections.East: StatusRotation = RotationDirections.South; square1.Location = new Point(square3.Location.X-squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X, square3.Location.Y+squareSize); square4.Location = new Point(square3.Location.X, square3.Location.Y+2*squareSize); break; case RotationDirections.South: StatusRotation = RotationDirections.West; square1.Location = new Point(square3.Location.X-2*squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X-squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X, square3.Location.Y-squareSize); break; case RotationDirections.West: StatusRotation = RotationDirections.North; square1.Location = new Point(square3.Location.X, square3.Location.Y-2*squareSize); square2.Location = new Point(square3.Location.X, square3.Location.Y-squareSize); square4.Location = new Point(square3.Location.X+squareSize, square3.Location.Y); break; } break; case BlockTypes.T: switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square3.Location = new Point(square2.Location.X, square2.Location.Y+squareSize); square4.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); break; case RotationDirections.East: StatusRotation = RotationDirections.South; square1.Location = new Point(square2.Location.X+squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); break; case RotationDirections.South: StatusRotation = RotationDirections.West; square1.Location = new Point(square2.Location.X, square2.Location.Y+squareSize); square3.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square4.Location = new Point(square2.Location.X+squareSize, square2.Location.Y); break; case RotationDirections.West: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X+squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X, square2.Location.Y+squareSize); break; } break; case BlockTypes.Z: // Rotate all squares around square 2 switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square3.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X-squareSize, square2.Location.Y+squareSize); break; case RotationDirections.East: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X, square2.Location.Y+squareSize); square4.Location = new Point(square2.Location.X+squareSize, square2.Location.Y+squareSize); break; } break; case BlockTypes.S: // Rotate all squares around square 2 switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square3.Location = new Point(square2.Location.X+squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X+squareSize, square2.Location.Y+squareSize); break; case RotationDirections.East: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square4.Location = new Point(square2.Location.X+squareSize, square2.Location.Y-squareSize); break; } break; } // After rotating the squares, test if they overlap other squares. // If so, return to original position if (!(GameField.IsEmpty(square1.Location.X/squareSize, square1.Location.Y/squareSize)&&GameField.IsEmpty(square2.Location.X/squareSize, square2.Location.Y/squareSize)&&GameField.IsEmpty(square3.Location.X/squareSize, square3.Location.Y/squareSize)&&GameField.IsEmpty(square4.Location.X/squareSize, square4.Location.Y/squareSize))) { StatusRotation = OldStatusRotation; square1.Location = OldPosition1; square2.Location = OldPosition2; square3.Location = OldPosition3; square4.Location = OldPosition4; } Show(GameField.GraphBackground); }
public void Rotate() { Point OldPosition1 = square1.Location; Point OldPosition2 = square2.Location; Point OldPosition3 = square3.Location; Point OldPosition4 = square4.Location; RotationDirections OldStatusRotation = StatusRotation; Hide(GameField.WinHandle); // Rotate the blocks switch(BlockType) { case BlockTypes.Square: // Square Doesn't rotate break; case BlockTypes.Line: // Rotate all squares around square 2 switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X+squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X+2*squareSize, square2.Location.Y); break; case RotationDirections.East: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square3.Location = new Point(square2.Location.X, square2.Location.Y+squareSize); square4.Location = new Point(square2.Location.X, square2.Location.Y+2*squareSize); break; } break; case BlockTypes.J: // Rotate all squares around square 3 switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square3.Location.X, square3.Location.Y-squareSize); square2.Location = new Point(square3.Location.X+squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X+2*squareSize, square3.Location.Y); break; case RotationDirections.East: StatusRotation = RotationDirections.South; square1.Location = new Point(square3.Location.X+squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X, square3.Location.Y+squareSize); square4.Location = new Point(square3.Location.X, square3.Location.Y+2*squareSize); break; case RotationDirections.South: StatusRotation = RotationDirections.West; square1.Location = new Point(square3.Location.X, square3.Location.Y+squareSize); square2.Location = new Point(square3.Location.X-squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X-2*squareSize, square3.Location.Y); break; case RotationDirections.West: StatusRotation = RotationDirections.North; square1.Location = new Point(square3.Location.X-squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X, square3.Location.Y-squareSize); square4.Location = new Point(square3.Location.X, square3.Location.Y-2*squareSize); break; } break; case BlockTypes.L: // Rotate all squares around square 3 switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square3.Location.X+squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X+2*squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X, square3.Location.Y+squareSize); break; case RotationDirections.East: StatusRotation = RotationDirections.South; square1.Location = new Point(square3.Location.X-squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X, square3.Location.Y+squareSize); square4.Location = new Point(square3.Location.X, square3.Location.Y+2*squareSize); break; case RotationDirections.South: StatusRotation = RotationDirections.West; square1.Location = new Point(square3.Location.X-2*squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X-squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X, square3.Location.Y-squareSize); break; case RotationDirections.West: StatusRotation = RotationDirections.North; square1.Location = new Point(square3.Location.X, square3.Location.Y-2*squareSize); square2.Location = new Point(square3.Location.X, square3.Location.Y-squareSize); square4.Location = new Point(square3.Location.X+squareSize, square3.Location.Y); break; } break; case BlockTypes.T: switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square3.Location = new Point(square2.Location.X, square2.Location.Y+squareSize); square4.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); break; case RotationDirections.East: StatusRotation = RotationDirections.South; square1.Location = new Point(square2.Location.X+squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); break; case RotationDirections.South: StatusRotation = RotationDirections.West; square1.Location = new Point(square2.Location.X, square2.Location.Y+squareSize); square3.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square4.Location = new Point(square2.Location.X+squareSize, square2.Location.Y); break; case RotationDirections.West: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X+squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X, square2.Location.Y+squareSize); break; } break; case BlockTypes.Z: // Rotate all squares around square 2 switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square3.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X-squareSize, square2.Location.Y+squareSize); break; case RotationDirections.East: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X, square2.Location.Y+squareSize); square4.Location = new Point(square2.Location.X+squareSize, square2.Location.Y+squareSize); break; } break; case BlockTypes.S: // Rotate all squares around square 2 switch(StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square3.Location = new Point(square2.Location.X+squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X+squareSize, square2.Location.Y+squareSize); break; case RotationDirections.East: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X-squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X, square2.Location.Y-squareSize); square4.Location = new Point(square2.Location.X+squareSize, square2.Location.Y-squareSize); break; } break; } if (!(GameField.IsEmpty(square1.Location.X/squareSize, square1.Location.Y/squareSize)&&GameField.IsEmpty(square2.Location.X/squareSize, square2.Location.Y/squareSize)&&GameField.IsEmpty(square3.Location.X/squareSize, square3.Location.Y/squareSize)&&GameField.IsEmpty(square4.Location.X/squareSize, square4.Location.Y/squareSize))) { StatusRotation = OldStatusRotation; square1.Location = OldPosition1; square2.Location = OldPosition2; square3.Location = OldPosition3; square4.Location = OldPosition4; } Show(GameField.WinHandle); }
public void Rotate() { // Store the current block position Point OldPosition1 = square1.Location; Point OldPosition2 = square2.Location; Point OldPosition3 = square3.Location; Point OldPosition4 = square4.Location; RotationDirections OldStatusRotation = StatusRotation; Hide(GameField.GraphBackground); // Rotate the blocks switch (BlockType) { case BlockTypes.Square: // Do nothing. Squares don't rotate. break; case BlockTypes.Line: // Rotate all squares around square 2 switch (StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X - squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X + squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X + 2 * squareSize, square2.Location.Y); break; case RotationDirections.East: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X, square2.Location.Y - squareSize); square3.Location = new Point(square2.Location.X, square2.Location.Y + squareSize); square4.Location = new Point(square2.Location.X, square2.Location.Y + 2 * squareSize); break; } break; case BlockTypes.J: // Rotate all squares around square 3 switch (StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square3.Location.X, square3.Location.Y - squareSize); square2.Location = new Point(square3.Location.X + squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X + 2 * squareSize, square3.Location.Y); break; case RotationDirections.East: StatusRotation = RotationDirections.South; square1.Location = new Point(square3.Location.X + squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X, square3.Location.Y + squareSize); square4.Location = new Point(square3.Location.X, square3.Location.Y + 2 * squareSize); break; case RotationDirections.South: StatusRotation = RotationDirections.West; square1.Location = new Point(square3.Location.X, square3.Location.Y + squareSize); square2.Location = new Point(square3.Location.X - squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X - 2 * squareSize, square3.Location.Y); break; case RotationDirections.West: StatusRotation = RotationDirections.North; square1.Location = new Point(square3.Location.X - squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X, square3.Location.Y - squareSize); square4.Location = new Point(square3.Location.X, square3.Location.Y - 2 * squareSize); break; } break; case BlockTypes.L: // Rotate all squares around square 3 switch (StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square3.Location.X + squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X + 2 * squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X, square3.Location.Y + squareSize); break; case RotationDirections.East: StatusRotation = RotationDirections.South; square1.Location = new Point(square3.Location.X - squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X, square3.Location.Y + squareSize); square4.Location = new Point(square3.Location.X, square3.Location.Y + 2 * squareSize); break; case RotationDirections.South: StatusRotation = RotationDirections.West; square1.Location = new Point(square3.Location.X - 2 * squareSize, square3.Location.Y); square2.Location = new Point(square3.Location.X - squareSize, square3.Location.Y); square4.Location = new Point(square3.Location.X, square3.Location.Y - squareSize); break; case RotationDirections.West: StatusRotation = RotationDirections.North; square1.Location = new Point(square3.Location.X, square3.Location.Y - 2 * squareSize); square2.Location = new Point(square3.Location.X, square3.Location.Y - squareSize); square4.Location = new Point(square3.Location.X + squareSize, square3.Location.Y); break; } break; case BlockTypes.T: switch (StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X, square2.Location.Y - squareSize); square3.Location = new Point(square2.Location.X, square2.Location.Y + squareSize); square4.Location = new Point(square2.Location.X - squareSize, square2.Location.Y); break; case RotationDirections.East: StatusRotation = RotationDirections.South; square1.Location = new Point(square2.Location.X + squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X - squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X, square2.Location.Y - squareSize); break; case RotationDirections.South: StatusRotation = RotationDirections.West; square1.Location = new Point(square2.Location.X, square2.Location.Y + squareSize); square3.Location = new Point(square2.Location.X, square2.Location.Y - squareSize); square4.Location = new Point(square2.Location.X + squareSize, square2.Location.Y); break; case RotationDirections.West: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X - squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X + squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X, square2.Location.Y + squareSize); break; } break; case BlockTypes.Z: // Rotate all squares around square 2 switch (StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X, square2.Location.Y - squareSize); square3.Location = new Point(square2.Location.X - squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X - squareSize, square2.Location.Y + squareSize); break; case RotationDirections.East: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X - squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X, square2.Location.Y + squareSize); square4.Location = new Point(square2.Location.X + squareSize, square2.Location.Y + squareSize); break; } break; case BlockTypes.S: // Rotate all squares around square 2 switch (StatusRotation) { case RotationDirections.North: StatusRotation = RotationDirections.East; square1.Location = new Point(square2.Location.X, square2.Location.Y - squareSize); square3.Location = new Point(square2.Location.X + squareSize, square2.Location.Y); square4.Location = new Point(square2.Location.X + squareSize, square2.Location.Y + squareSize); break; case RotationDirections.East: StatusRotation = RotationDirections.North; square1.Location = new Point(square2.Location.X - squareSize, square2.Location.Y); square3.Location = new Point(square2.Location.X, square2.Location.Y - squareSize); square4.Location = new Point(square2.Location.X + squareSize, square2.Location.Y - squareSize); break; } break; } // After rotating the squares, test if they overlap other squares. // If so, return to original position if (!(GameField.IsEmpty(square1.Location.X / squareSize, square1.Location.Y / squareSize) && GameField.IsEmpty(square2.Location.X / squareSize, square2.Location.Y / squareSize) && GameField.IsEmpty(square3.Location.X / squareSize, square3.Location.Y / squareSize) && GameField.IsEmpty(square4.Location.X / squareSize, square4.Location.Y / squareSize))) { StatusRotation = OldStatusRotation; square1.Location = OldPosition1; square2.Location = OldPosition2; square3.Location = OldPosition3; square4.Location = OldPosition4; } Show(GameField.GraphBackground); }