parent
893453b12c
commit
a93c6bbd4c
|
@ -128,12 +128,17 @@ public class CameraRT : MonoBehaviour
|
|||
float init_y;
|
||||
bool auto_move;
|
||||
|
||||
float dotween_duration = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// 全景视角
|
||||
/// </summary>
|
||||
public void InitPanoramic()
|
||||
{
|
||||
auto_move = true;
|
||||
|
||||
DOTween.Kill(transform, false);
|
||||
DOTween.Kill(cameraTransform, false);
|
||||
//target.position = target_init_position;
|
||||
//target.rotation = target_init_rotation;
|
||||
|
||||
|
@ -159,14 +164,14 @@ public class CameraRT : MonoBehaviour
|
|||
|
||||
distance = 20;
|
||||
|
||||
DOTween.To(() => x, (v) => x = v, init_x, 0.5f);
|
||||
DOTween.To(() => y, (v) => y = v, init_y, 0.5f);
|
||||
DOTween.To(() => x, (v) => x = v, init_x, dotween_duration);
|
||||
DOTween.To(() => y, (v) => y = v, init_y, dotween_duration);
|
||||
|
||||
DOTween.To(() => cam.transform.position, (v) => cam.transform.position = v, camera_init_position, 0.5f);
|
||||
DOTween.To(() => cam.transform.eulerAngles, v => cam.transform.eulerAngles = v, camera_init_eulerAngles, 0.5f);
|
||||
DOTween.To(() => cam.transform.position, (v) => cam.transform.position = v, camera_init_position, dotween_duration);
|
||||
DOTween.To(() => cam.transform.eulerAngles, v => cam.transform.eulerAngles = v, camera_init_eulerAngles, dotween_duration);
|
||||
|
||||
DOTween.To(() => target.position, v => target.position = v, target_init_position, 0.5f);
|
||||
DOTween.To(() => target.eulerAngles, v => target.eulerAngles = v, target_init_eulerAngles, 0.5f).OnComplete(() => { auto_move = false; });
|
||||
DOTween.To(() => target.position, v => target.position = v, target_init_position, dotween_duration);
|
||||
DOTween.To(() => target.eulerAngles, v => target.eulerAngles = v, target_init_eulerAngles, dotween_duration).OnComplete(() => { auto_move = false; });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -175,6 +180,8 @@ public class CameraRT : MonoBehaviour
|
|||
public void InitBirds_Eye()
|
||||
{
|
||||
auto_move = true;
|
||||
DOTween.Kill(transform, false);
|
||||
DOTween.Kill(cameraTransform, false);
|
||||
Array.ForEach(GameObject.FindObjectsOfType<ClickEvent>(), itme =>
|
||||
{
|
||||
itme.My_magnifyState = false;
|
||||
|
@ -192,14 +199,14 @@ public class CameraRT : MonoBehaviour
|
|||
|
||||
distance = 10;
|
||||
|
||||
DOTween.To(() => x, (v) => x = v, 110, 0.5f);
|
||||
DOTween.To(() => y, (v) => y = v, 15, 0.5f);
|
||||
DOTween.To(() => x, (v) => x = v, 110, dotween_duration);
|
||||
DOTween.To(() => y, (v) => y = v, 15, dotween_duration);
|
||||
|
||||
DOTween.To(() => cam.transform.position, (v) => cam.transform.position = v, new Vector3(1, 2.8f, -7.5f), 0.5f);
|
||||
DOTween.To(() => cam.transform.eulerAngles, v => cam.transform.eulerAngles = v, new Vector3(15, 110, 0), 0.5f);
|
||||
DOTween.To(() => cam.transform.position, (v) => cam.transform.position = v, new Vector3(1, 2.8f, -7.5f), dotween_duration);
|
||||
DOTween.To(() => cam.transform.eulerAngles, v => cam.transform.eulerAngles = v, new Vector3(15, 110, 0), dotween_duration);
|
||||
|
||||
DOTween.To(() => target.position, v => target.position = v, new Vector3(10.2f, 0.2f, -11), 0.5f);
|
||||
DOTween.To(() => target.eulerAngles, v => target.eulerAngles = v, new Vector3(0, 110, 0), 0.5f).OnComplete(() => { auto_move = false; });
|
||||
DOTween.To(() => target.position, v => target.position = v, new Vector3(10.2f, 0.2f, -11), dotween_duration);
|
||||
DOTween.To(() => target.eulerAngles, v => target.eulerAngles = v, new Vector3(0, 110, 0), dotween_duration).OnComplete(() => { auto_move = false; });
|
||||
}
|
||||
|
||||
public Vector3 resume_position;
|
||||
|
@ -378,9 +385,14 @@ public class CameraRT : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
bool is_on_ui;
|
||||
void Rotate()
|
||||
{
|
||||
if (Input.GetMouseButton(1))
|
||||
if (Input.GetMouseButtonDown(1))
|
||||
{
|
||||
is_on_ui = EventSystem.current.IsPointerOverGameObject();
|
||||
}
|
||||
if (Input.GetMouseButton(1)&&!is_on_ui)
|
||||
{
|
||||
|
||||
// 判断是否需要反向旋转
|
||||
|
@ -401,6 +413,9 @@ public class CameraRT : MonoBehaviour
|
|||
|
||||
void Scroll()
|
||||
{
|
||||
if (EventSystem.current.IsPointerOverGameObject())
|
||||
return;
|
||||
|
||||
distance -= Input.GetAxis("Mouse ScrollWheel") * mSpeed_scale;
|
||||
distance = Mathf.Clamp(distance, minDistance, maxDistance);
|
||||
|
||||
|
|
Loading…
Reference in New Issue