public override void Reset() { this.baseOrientation = GetDeviceRoll.BaseOrientation.LandscapeLeft; this.storeAngle = null; this.limitAngle = new FsmFloat { UseVariable = true }; this.smoothing = 5f; this.everyFrame = true; }
public override void Reset() { this.baseOrientation = GetDeviceRoll.BaseOrientation.LandscapeLeft; this.storeAngle = null; this.limitAngle = new FsmFloat { UseVariable = true }; this.smoothing = 5f; this.everyFrame = true; }
private void DoGetDeviceRoll() { float x = Input.acceleration.x; float y = Input.acceleration.y; float num = 0f; GetDeviceRoll.BaseOrientation baseOrientation = this.baseOrientation; if (baseOrientation != GetDeviceRoll.BaseOrientation.Portrait) { if (baseOrientation != GetDeviceRoll.BaseOrientation.LandscapeLeft) { if (baseOrientation == GetDeviceRoll.BaseOrientation.LandscapeRight) { num = -Mathf.Atan2(y, x); } } else { num = Mathf.Atan2(y, -x); } } else { num = -Mathf.Atan2(x, -y); } if (!this.limitAngle.IsNone) { num = Mathf.Clamp(57.29578f * num, -this.limitAngle.Value, this.limitAngle.Value); } if (this.smoothing.Value > 0f) { num = Mathf.LerpAngle(this.lastZAngle, num, this.smoothing.Value * Time.deltaTime); } this.lastZAngle = num; this.storeAngle.Value = num; }