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); }
public override void Update() { if (this.m_target != null && this.m_SecondTarget != null) { CBehaviorFollowFrontPin 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 single = mTarget.magnitude; mTarget.Normalize(); Vector3 mFollowRate = (((mTarget + (mTarget * single)) * this.m_followRate) * this.m_transitionAcceleration) * Time.smoothDeltaTime; Vector3 vector3 = this.m_target.transform.position; float mFollowHeight = vector3.y + this.m_followHeight; float single1 = mFollowRate.y; Vector3 mCameraTransform = this.m_cameraTransform.position; mFollowRate.y = single1 + (mFollowHeight - mCameraTransform.y) * this.m_followHeightRate * this.m_transitionAcceleration * Time.smoothDeltaTime; Transform transforms = this.m_cameraTransform; transforms.position = transforms.position + mFollowRate; Vector3 mCameraTransform1 = this.m_cameraTransform.forward * -0.5f; this.m_cameraTransform.position = this.m_cameraTransform.position + mCameraTransform1; Quaternion quaternion = Quaternion.LookRotation(this.m_SecondTarget.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 * 1f); } }