public void Rotate(RotateDirection dir) { System.Diagnostics.Debug.Assert(NumColumns == 2 && NumRows == 2); var cells = DropPieceSimple.Cells; if (dir == RotateDirection.Left) { var first = cells[0][0]; cells[0][0] = cells[0][1]; cells[0][1] = cells[1][1]; cells[1][1] = cells[1][0]; cells[1][0] = first; } else { var first = cells[0][0]; cells[0][0] = cells[1][0]; cells[1][0] = cells[1][1]; cells[1][1] = cells[0][1]; cells[0][1] = first; } Rotated?.Invoke(this, new RotateEventArgs(dir)); }
private void PosVectorRotated(float angleRadians) { if (Rotated != null) { Rotated.Invoke(angleRadians); } }
void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag(Tags.Wind)) { logRotateVel = logVelFirst; Rotated?.Invoke(this, EventArgs.Empty); } }
public static void OnDrag(PointerEventData eventData, Vector2 center) { if (_rotated || ++_counter != 2) { return; } _rotated = true; Rotated?.Invoke(GetRotationDirection(center, eventData.delta)); }
public void Rotate(int deltaAngle) { if (deltaAngle == 0) { return; } transform.Rotate(axisVector, deltaAngle); // Round to try and correct percision errors so that they don't add up to be something significant var eulers = transform.localEulerAngles; transform.localEulerAngles = new Vector3(Mathf.Round(eulers.x), Mathf.Round(eulers.y), Mathf.Round(eulers.z)); Rotated?.Invoke(this, deltaAngle); }
private void FindDirection(uint new2LsBits) { _dynamicOffset <<= 2; // Move previous A & B to bits 2 & 3 _dynamicOffset |= new2LsBits; // Set the current A & B states in bits 0 & 1 _dynamicOffset &= 0x0000000f; // Save only lowest 4 bits int direction = RotEncLookup[_dynamicOffset]; if (direction == 0) { return; // nothing changed } if (direction == 1) { Rotated?.Invoke(this, new RotaryTurnedEventArgs(RotationDirection.Clockwise)); } else { Rotated?.Invoke(this, new RotaryTurnedEventArgs(RotationDirection.CounterClockwise)); } }
/// <summary> /// Invokes the RotaryTurnedEventHandler, passing the direction in the RotaryTurnedEventArgs /// </summary> /// <param name="direction"></param> protected void OnRaiseRotationEvent(RotationDirection direction) { Rotated?.Invoke(this, new RotaryTurnedEventArgs(direction)); }