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 Rotate180() { roomGrid.rotation = (Rotated)(((int)roomGrid.rotation + 2) & 4); rotation = roomGrid.rotation; foreach (Door door in doors) { door.rotation = roomGrid.rotation; } }
public void RotateClockwise90() { roomGrid.rotation = (Rotated)(((int)roomGrid.rotation + 1) & 4); rotation = roomGrid.rotation; foreach (Door door in doors) { door.rotation = roomGrid.rotation; } }
public void RotateTo(Rotated _rotation) { roomGrid.rotation = _rotation; rotation = roomGrid.rotation; foreach (Door door in doors) { door.rotation = roomGrid.rotation; } }
public void Rotate0() { roomGrid.rotation = Rotated.ZERO; rotation = roomGrid.rotation; foreach (Door door in doors) { door.rotation = roomGrid.rotation; } }
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)); } }
public Door(Vector2 pos, EnumDirection dir, Rotated rot) { posOnGrid = pos; direction = dir; rotation = rot; }
/// <inheritdoc /> protected override void ConfigureComponent() { string color = ""; string options = ""; ElementTag = "i"; if (Disabled) { options = $"{options}disabled "; } if (Loading) { options = $"{options}loading "; } if (Fitted) { options = $"{options}fitted "; } if (Link) { options = $"{options}link "; } if (Flipped != FlipDirection.None) { options = $"{options}{Flipped.GetDescription()} flipped "; } if (Rotated != Rotation.None) { options = $"{options}{Rotated.GetDescription()} rotated "; } if (Corner != Corner.None) { options = Corner == Corner.Default ? $"{options} corner " : $"{options}{Corner.GetDescription()} corner "; } if (Circular) { options = $"{options}circular "; } if (Bordered) { options = $"{options}bordered "; } if (Inverted) { options = $"{options}inverted "; } if (Color != Color.None) { color = $"{Color.GetDescription()} "; } if (Size != Size.None && Size != Size.Medium) { options = $"{options}{Size.GetDescription()} "; } ElementClass = $"{color}{Name.GetDescription()} {options}icon"; }
/// <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)); }