public virtual CameraFollowParam getCurrentFollowParam(CameraFollowParam cmeraFollowParam = null) { if (cmeraFollowParam == null) { cmeraFollowParam = new CameraFollowParam(); } if (this._toCameraParam != null) { cmeraFollowParam.distance = _toCameraParam.distance; cmeraFollowParam.height = _toCameraParam.height; cmeraFollowParam.heightLookAt = _toCameraParam.heightLookAt; cmeraFollowParam.rotationAngle = _toCameraParam.rotationAngle; cmeraFollowParam.offset = _toCameraParam.offset; cmeraFollowParam.cameraOffset = _toCameraParam.offset; cmeraFollowParam.offsetLookAt = _toCameraParam.offsetLookAt; } else { cmeraFollowParam.distance = this.distance; cmeraFollowParam.height = this.height; cmeraFollowParam.heightLookAt = this.heightLookAt; cmeraFollowParam.rotationAngle = this.rotationAngle; cmeraFollowParam.offset = this.offset; cmeraFollowParam.cameraOffset = this.offset; cmeraFollowParam.offsetLookAt = this.offsetLookAt; } return(cmeraFollowParam); }
public virtual void resetDefault(CameraFollowParam cameraFollowParam = null, bool hasTween = true, float slepTime = 1.0f) { if (cameraFollowParam != null) { _defaultCameraFollowParam = cameraFollowParam; } isCameraFocusing = false; this.toDistance = _defaultCameraFollowParam.distance; this.height = _defaultCameraFollowParam.height; this.heightLookAt = _defaultCameraFollowParam.heightLookAt; this.rotationAngle = _defaultCameraFollowParam.rotationAngle; this.offset = _defaultCameraFollowParam.offset; this.cameraOffset = _defaultCameraFollowParam.cameraOffset; this.offsetLookAt = _defaultCameraFollowParam.offsetLookAt; this._shakeOffset = Vector3.zero; _startResetSlepTime = Time.time; _isNeedResetDistance = true; if (hasTween == false) { this.distance = this.toDistance; updateTransform(1.0f, 1.0f); } else { this.slepTime = slepTime - this.elapseTime; } }
protected virtual void Start() { refreashCamera(); if (_defaultCameraFollowParam == null) { toDistance = distance; _defaultCameraFollowParam = getCurrentFollowParam(_defaultCameraFollowParam); } this._isStartSlep = false; }
public virtual CameraFollowParam getFollowParam(Vector3 position) { CameraFollowParam cameraFollowParam = new CameraFollowParam(); Vector3 followPosition = followObject.transform.position; int rotationAngle = (int)Angle_360(Vector3.forward, new Vector3(followPosition.x - position.x, 0f, followPosition.z - position.z), Vector3.up); cameraFollowParam.rotationAngle = new Vector3(0, rotationAngle, 0); float dis = Vector3.Distance(new Vector3(followPosition.x, 0f, followPosition.z), new Vector3(position.x, 0f, position.z)); cameraFollowParam.distance = dis; cameraFollowParam.height = position.y - this.followObject.transform.position.y; return(cameraFollowParam); }
public virtual void StartSlep(CameraFollowParam toCameraParam, float slepTime = 1f) { if (toCameraParam == null) { return; } DebugX.Log("===============StartSlep"); getCurrentFollowParam(this._fromCameraParam); this._toCameraParam = toCameraParam; //if (this._isStartSlep == false) { this.elapseTime = 0f; } this.slepTime = slepTime - this.elapseTime; this._startSlepTime = Time.time; this._isStartSlep = true; }