public MatrixRotationInfo(MatrixMove matrixMove, RotationOffset rotationOffset, NetworkSide networkSide, RotationEvent rotationEvent) { MatrixMove = matrixMove; RotationOffset = rotationOffset; NetworkSide = networkSide; RotationEvent = rotationEvent; }
public override void UpdateEventHandler() { RotationEvent newEvent = new RotationEvent(); newEvent.rotation = target.rotation; TimeController.instance.AddEvent(newEvent, this); }
private async Task _loop() { while (_running) { try { var result = await _mouseDevice.ReadAsync(); if (result.BytesRead >= 7) { if (result.Data[0] == (int)EventType.Translation) { CurrentTranslation = toVector3(result.Data) * TranslationScale; TranslationEvent?.Invoke(this, CurrentTranslation); } else if (result.Data[0] == (int)EventType.Rotation) { CurrentRotation = toVector3(result.Data) * RotationScale; RotationEvent?.Invoke(this, CurrentRotation); } else if (result.Data[0] == (int)EventType.Buttons) { CurrentButtons = ConvertByteArrayToBoolArray(result.Data.Skip(1).ToArray()); ButtonEvent?.Invoke(this, CurrentButtons); } } } catch (Exception ex) { } } }
void Rotate(RotationEvent e) { Vector3 rotation = transform.eulerAngles; rotation.z = e.rotation; // Standart Left-/Right Arrows and A & D Keys transform.eulerAngles = rotation; }
//======================================================= // Rotation Handlers //======================================================= public override void OnUpdateRotation(byte newFlags) { base.OnUpdateRotation(newFlags); Quaternion rotation = SegmentCustomRenderer.GetRotationQuaternion(newFlags); Forward = rotation * Vector3.forward; Left = rotation * Vector3.left; Up = rotation * Vector3.up; RotationEvent?.Invoke(this, rotation); }
private void Update() { if (!IsApplying) { return; } if (target.transform.rotation != _rotationPrevious) { RotationEvent?.Invoke(target.transform.localEulerAngles); onRotation?.Invoke(); } _rotationPrevious = target.transform.rotation; }
void Update() { if (Input.anyKey) { Vector3 rotation = transform.eulerAngles; rotation.z += Input.GetAxis("Horizontal") * rotationSpeed * Time.deltaTime; // Standart Left-/Right Arrows and A & D Keys transform.eulerAngles = rotation; RotationEvent e = new RotationEvent(rotation.z); e.FireEvent(); } }
/// <summary> /// Matrix rotation info where a rotation is performed from the matrixmove's initial facing to its current facing. /// </summary> /// <returns></returns> public static MatrixRotationInfo FromInitialRotation(MatrixMove matrixMove, NetworkSide side, RotationEvent rotationEvent) { return(new MatrixRotationInfo(matrixMove, matrixMove.FacingOffsetFromInitial, side, rotationEvent)); }
public override void ApplyEvent(TimeEvent timeEvent, bool reverse) { RotationEvent newEvent = (RotationEvent)timeEvent; target.rotation = newEvent.rotation; }
// Start is called before the first frame update void Start() { RotationEvent.RegisterListener(Rotate); }
/** * raises RotationEvent */ private void OnRotationEvent(float e) { RotationEvent?.Invoke(this, e); }