Example #1
0
        protected override void Update(Microsoft.Xna.Framework.GameTime gt)
        {
            time += (float)gt.ElapsedGameTime.TotalMilliseconds;
            if (data.getMaxTime() < time)
            {
                if (onLoop == true)
                {
                    if (OnPathEnded != null)
                    {
                        OnPathEnded(this);
                    }
                    Restart();
                    return;
                }

                ICamera cnext = world.CameraManager.GetCamera(nextCam);

                cnext.Position = this.Position;
                cnext.Target   = this.Target;
                cnext.Up       = this.Up;

                String old_active = world.CameraManager.GetActiveCameraName();
                world.CameraManager.SetActiveCamera(cnext.Name);
                world.CameraManager.RemoveCamera(old_active);
                ended = true;

                if (OnPathEnded != null)
                {
                    OnPathEnded(this);
                }

                return;
            }
            _target   = data.GetTarget(time);
            _up       = data.GetUp(time);
            _position = data.GetHead(time);
            _view     = Matrix.CreateLookAt(_position, _target, _up);
            vp        = View * Projection;
        }