public override void Update() { if (this.m_target != null) { CBehaviorFollowFront mTransitionAcceleration = this; mTransitionAcceleration.m_transitionAcceleration = mTransitionAcceleration.m_transitionAcceleration + Time.deltaTime * 0.2f; Mathf.Clamp(this.m_transitionAcceleration, 0f, 1f); Vector3 mTarget = this.m_target.transform.position - this.m_cameraTransform.position; float mFollowRadius = mTarget.magnitude - this.m_followRadius; mTarget.Normalize(); Vector3 mFollowRate = (((mTarget + (mTarget * mFollowRadius)) * this.m_followRate) * this.m_transitionAcceleration) * Time.smoothDeltaTime; Vector3 vector3 = this.m_target.transform.position; float mFollowHeight = vector3.y + this.m_followHeight; float single = mFollowRate.y; Vector3 mCameraTransform = this.m_cameraTransform.position; mFollowRate.y = single + (mFollowHeight - mCameraTransform.y) * this.m_followHeightRate * this.m_transitionAcceleration * Time.smoothDeltaTime; Transform transforms = this.m_cameraTransform; transforms.position = transforms.position + mFollowRate; float mCameraTransform1 = this.m_cameraTransform.rotation.eulerAngles.y; float mFollowAngle = this.m_followAngle - mCameraTransform1; if (this.m_continuallyOrbit) { this.m_cameraTransform.RotateAround(this.m_target.transform.position, Vector3.up, this.m_orbitRate * Time.smoothDeltaTime); } else { this.m_cameraTransform.RotateAround(this.m_target.transform.position, Vector3.up, mFollowAngle * this.m_followRotationRate * Time.smoothDeltaTime); } Quaternion quaternion = Quaternion.LookRotation(this.m_target.transform.position - this.m_cameraTransform.position); this.m_cameraTransform.rotation = Quaternion.Slerp(this.m_cameraTransform.rotation, quaternion, Time.deltaTime * this.m_transitionAcceleration * this.m_lookAtRate * 5f); } }
private void Start() { if (this.m_pinTarget == null) { this.m_pinTarget = GameObject.FindGameObjectWithTag("FalgGreen"); } this.m_behaviorType = CGolfCamera.CAMERA_BEHAVIOR.CAMERA_NO_BEHAVIOR; this.m_behaviorStatic = new CBehaviorStatic(base.transform); this.m_behaviorStaticCutPin = new CBehaviorStaticCutPin(base.transform); this.m_behaviorFollowBehind = new CBehaviorFollowBehind(base.transform); this.m_behaviorFollowFront = new CBehaviorFollowFront(base.transform); this.m_behavior45Degrees = new CBehavior45Degrees(base.transform); this.m_behavior45DegreesZoom = new CBehavior45DegreesZoom(base.transform); this.m_behaviorStaticDownrange = new CBehaviorStaticDownrange(base.transform); this.m_behaviorFollowFrontPin = new CBehaviorFollowFrontPin(base.transform); this.m_behaviorDynamic = new CBehaviorDynamic(base.transform); this.SetCameraBehavior(CGolfCamera.CAMERA_BEHAVIOR.CAMERA_STATIC_USER_PERSPECTIVE); }