private void RecordAudioChecked(object sender, RoutedEventArgs e) { PlayAudio.IsEnabled = false; ApplicationBar.IsVisible = false; RotateCircle.Begin(); _recorder.Start(); }
private void RecordAudioUnchecked(object sender, RoutedEventArgs e) { _recorder.Stop(); SaveTempAudio(_recorder.Buffer); PlayAudio.IsEnabled = true; ApplicationBar.IsVisible = true; RotateCircle.Stop(); }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
private void resetSpeed(RotateCircle parentTag) { if (parentTag.rotateSpeed > 0) { rotateSpeed += 2 * parentTag.rotateSpeed; } else { rotateSpeed -= 2 * parentTag.rotateSpeed; } }
private void MoveTheGoddamnMoon(int fromSegment, int toSegment) { //@NOTE: This is all kinds of scuffed, but deadline is in 3 hours so.. //@NOTE: Clockwise and Anticlockwise are mislabeled here! NO TIME TO REFACTOR if (fromSegment == -1) { fromSegment = RotateCircle.GetDefaultPosition(0); } var deltas = new[] { 0.05f, // 0->1 0.25f, // 1->2 0.15f, // 2->3 0.05f, // 3->4 0.05f, // 4->5 0.25f, // 5->6 0.15f, // 6->7 0.05f, // 7->0 }; // Clockwise, incrementing int clockwise = fromSegment; float clockwiseDistance = 0.0f; while (clockwise != toSegment) { clockwiseDistance += deltas[clockwise]; clockwise = Mathfs.Mod(clockwise + 1, 8); } // Anticlockwise, decrementing int anticlockwise = fromSegment; float anticlockwiseDistance = 0.0f; while (anticlockwise != toSegment) { anticlockwise = Mathfs.Mod(anticlockwise - 1, 8); anticlockwiseDistance += deltas[anticlockwise]; } if (clockwiseDistance < anticlockwiseDistance) { // move clockwise _targetPhase = _currentMoonPhase + clockwiseDistance; } else { // move anticlockwise _targetPhase = _currentMoonPhase - anticlockwiseDistance; } }
void Start() { if (transform.tag == "InsideCircle") { parentCircle = GetComponentInParent <RotateCircle>(); resetSpeed(parentCircle); } else { rotateSpeed += Random.Range(70, maxSpeed); isReverse = Random.Range(0, 10) > 5 ? true : false; if (isReverse) { rotateSpeed *= -1f; } } }