ICinemachineCamera.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using UnityEngine;
  2. namespace Cinemachine
  3. {
  4. /// <summary>
  5. /// An abstract representation of a virtual camera which lives within the Unity scene
  6. /// </summary>
  7. public interface ICinemachineCamera
  8. {
  9. /// <summary>
  10. /// Gets the name of this virtual camera. For use when deciding how to blend
  11. /// to or from this camera
  12. /// </summary>
  13. string Name { get; }
  14. /// <summary>
  15. /// Gets a brief debug description of this virtual camera, for use when displayiong debug info
  16. /// </summary>
  17. string Description { get; }
  18. /// <summary>
  19. /// Gets the priority of this <c>ICinemachineCamera</c>. The virtual camera
  20. /// will be inserted into the global priority stack based on this value.
  21. /// </summary>
  22. int Priority { get; set; }
  23. /// <summary>
  24. /// The thing the camera wants to look at (aim). May be null.
  25. /// </summary>
  26. Transform LookAt { get; set; }
  27. /// <summary>
  28. /// The thing the camera wants to follow (moving camera). May be null.
  29. /// </summary>
  30. Transform Follow { get; set; }
  31. /// <summary>
  32. /// Camera state at the current time.
  33. /// </summary>
  34. CameraState State { get; }
  35. /// <summary>
  36. /// Gets the virtual camera game attached to this class.
  37. /// </summary>
  38. GameObject VirtualCameraGameObject { get; }
  39. /// <summary>
  40. /// Will return false if this references a deleted object
  41. /// </summary>
  42. bool IsValid { get; }
  43. /// <summary>
  44. /// For cameras that implement child cameras, returns the parent vcam, otherwise null.
  45. /// </summary>
  46. ICinemachineCamera ParentCamera { get; }
  47. /// <summary>Check whether the vcam is a live child of this camera.</summary>
  48. /// <param name="vcam">The Virtual Camera to check</param>
  49. /// <param name="dominantChildOnly">If truw, will only return true if this vcam is the dominat live child</param>
  50. /// <returns>True if the vcam is currently actively influencing the state of this vcam</returns>
  51. bool IsLiveChild(ICinemachineCamera vcam, bool dominantChildOnly = false);
  52. /// <summary>
  53. /// Update the camera's state.
  54. /// The implementation must guarantee against multiple calls per frame, and should
  55. /// use CinemachineCore.UpdateVirtualCamera(ICinemachineCamera, Vector3, mfloat), which
  56. /// has protection against multiple calls per frame.
  57. /// </summary>
  58. /// <param name="worldUp">Default world Up, set by the CinemachineBrain</param>
  59. /// <param name="deltaTime">Delta time for time-based effects (ignore if less than 0)</param>
  60. void UpdateCameraState(Vector3 worldUp, float deltaTime);
  61. /// <summary>
  62. /// Updates this Cinemachine Camera. For an active camera this should be
  63. /// called once and only once each frame. To guarantee this, you should never
  64. /// call this method directly. Always use
  65. /// CinemachineCore.UpdateVirtualCamera(ICinemachineCamera, Vector3, float), which
  66. /// has protection against multiple calls per frame.
  67. /// </summary>
  68. /// <param name="worldUp">Default world Up, set by the CinemachineBrain</param>
  69. /// <param name="deltaTime">Delta time for time-based effects (ignore if less than 0)</param>
  70. void InternalUpdateCameraState(Vector3 worldUp, float deltaTime);
  71. /// <summary>
  72. /// Notification that a new camera is being activated. This is sent to the
  73. /// currently active camera. Both may be active simultaneously for a while, if blending.
  74. /// </summary>
  75. /// <param name="fromCam">The camera being deactivated. May be null.</param>
  76. /// <param name="worldUp">Default world Up, set by the CinemachineBrain</param>
  77. /// <param name="deltaTime">Delta time for time-based effects (ignore if less than 0)</param>
  78. void OnTransitionFromCamera(ICinemachineCamera fromCam, Vector3 worldUp, float deltaTime);
  79. /// <summary>This is called to notify the component that a target got warped,
  80. /// so that the component can update its internal state to make the camera
  81. /// also warp seamlessy. Base class implementation does nothing.</summary>
  82. /// <param name="target">The object that was warped</param>
  83. /// <param name="positionDelta">The amount the target's position changed</param>
  84. void OnTargetObjectWarped(Transform target, Vector3 positionDelta);
  85. }
  86. }