private void ExecuteCameraAnimation(BaseCamera cam, AnimationVector3 v2Anim) { v2Anim.Animated += delegate { var angle = v2Anim.Current.Z; var radius = v2Anim.Current.X; CurrentCamRadius = radius; CurrentCamTabAngle = angle; radius += v2Anim.Current.Y; cam.Position = new Microsoft.Xna.Framework.Vector3((float)(Math.Cos(angle) * radius), 0, (float)(Math.Sin(angle) * radius)); }; }
private void MoveCameraTo(float activeRadius, float activeTabAngle) { if (debugView) { activeTabAngle = MathHelper.PiOver2; } var cam = D3DScreen.CurrentEngine.CameraManager.ActiveCamera; var v2Anim = new AnimationVector3(D3DScreen.CurrentEngine, TimeSpan.FromSeconds(0.8), new KeyValuePair<float, Vector3>(0, new Vector3() { X = CurrentCamRadius, Y = radiusOffsetNormal, Z = CurrentCamTabAngle }), new KeyValuePair<float, Vector3>(0.4f, new Vector3() { X = CurrentCamRadius, Y = radiusOffsetMovement, Z = CurrentCamTabAngle * 0.6f + activeTabAngle * 0.4f }), new KeyValuePair<float, Vector3>(0.6f, new Vector3() { X = activeRadius, Y = radiusOffsetMovement, Z = CurrentCamTabAngle * 0.4f + activeTabAngle * 0.6f }), new KeyValuePair<float, Vector3>(1, new Vector3() { X = activeRadius, Y = radiusOffsetNormal, Z = activeTabAngle })); ExecuteCameraAnimation(cam, v2Anim); D3DScreen.CurrentEngine.AnimationManager.Start(v2Anim); }