public override ActionResult Execute(ScriptExecutionContext context) { if (_animation == null) { _animation = context.Scene.CameraController.StartAnimation( new[] { context.Scene.CameraController.TerrainPosition, _targetPoint }, context.UpdateTime.TotalTime, _duration); } return(_animation.Finished ? Finished : this); }
public override ActionResult Execute(ScriptExecutionContext context) { if (_animation == null) { // TODO: Avoid allocating this list? // TODO: Does the real engine start the animation from the current position? var pathWithCurrentPos = new List <Vector3> { context.Scene.CameraController.TerrainPosition }; pathWithCurrentPos.AddRange(_path.Select(waypoint => waypoint.Position)); _animation = context.Scene.CameraController.StartAnimation( pathWithCurrentPos, context.UpdateTime.TotalTime, _totalDuration); } return(_animation.Finished ? ActionResult.Finished : this); }
public override ActionResult Execute(ScriptExecutionContext context) { if (_animation == null) { // TODO: Avoid allocating this list? // TODO: Does the real engine start the animation from the current position? // Calling .ToList() here is dangerous, as a path could contain a loop, // but it shouldn't happen for camera paths (the original ZH freezes as well // when you try this). var pathWithCurrentPos = _path.Prepend(context.Scene.CameraController.TerrainPosition).ToList(); _animation = context.Scene.CameraController.StartAnimation( pathWithCurrentPos, context.UpdateTime.TotalTime, _totalDuration); } return(_animation.Finished ? ActionResult.Finished : this); }