private IEnumerator PulseOnBeat() { yield return(new WaitForSecondsRealtime(waitToStartTime)); while (true) { beat++; if (beat == 1) { Beat1.Invoke(); } else if (beat == 2) { Beat2.Invoke(); } else if (beat == 3) { Beat3.Invoke(); } else { Beat4.Invoke(); beat = 0; } yield return(new WaitForSecondsRealtime(secondsBetweenBeat)); } }
public static void MakeBeat(double secs) { Beat1?.Invoke(secs); Beat2?.Invoke(); var trans = MyLib.Transform(CameraProperties.BaseTransform); trans = trans.TranslatePrepend(CameraProperties.position - new Point3D()); var cross = Vector3D.CrossProduct(Kernel.Camera.LookDirection, CameraProperties.lookDirection); if (cross.Length != 0) { var dot = Vector3D.DotProduct(Kernel.Camera.LookDirection, CameraProperties.lookDirection); var angle = Math.Acos(dot / Kernel.Camera.LookDirection.Length / CameraProperties.lookDirection.Length); trans = trans.RotatePrepend(cross, angle); } //if (Keyboard.IsDown(System.Windows.Input.Key.Z)) System.Diagnostics.Trace.WriteLine(CameraProperties.position-new Point3D()); Kernel.Camera.Transform = trans.Value; }