using UnityEngine;
namespace Cinemachine
{
///
/// This is a CinemachineComponent in the Aim section of the component pipeline.
/// Its job is to aim the camera hard at the LookAt target.
///
[DocumentationSorting(27, DocumentationSortingAttribute.Level.UserRef)]
[AddComponentMenu("")] // Don't display in add component menu
[RequireComponent(typeof(CinemachinePipeline))]
[SaveDuringPlay]
public class CinemachineSameAsFollowObject : CinemachineComponentBase
{
/// True if component is enabled and has a Follow target defined
public override bool IsValid { get { return enabled && FollowTarget != null; } }
/// Get the Cinemachine Pipeline stage that this component implements.
/// Always returns the Aim stage
public override CinemachineCore.Stage Stage { get { return CinemachineCore.Stage.Aim; } }
/// Applies the composer rules and orients the camera accordingly
/// The current camera state
/// Used for calculating damping. If less than
/// zero, then target will snap to the center of the dead zone.
public override void MutateCameraState(ref CameraState curState, float deltaTime)
{
if (IsValid)
curState.RawOrientation = FollowTarget.transform.rotation;
}
}
}