using System; using System.Collections; using System.Collections.Generic; using DG.Tweening; using UnityEngine; /// /// 相机变换 /// public class CameraTrans : MonoBehaviour { public Transform pos; public Vector2 area; public float flagFloat = 0; private void Awake() { // GameStageManager.Instance.stageDict[GameStage.漫游].OnUpdateAdd += () => // { // if (Input.GetMouseButton(0) && Input.GetAxis("Mouse X") !=0) // { // transform.localEulerAngles += Vector3.up * Input.GetAxis("Mouse X"); // } // }; // GameStageManager.Instance.stageDict[GameStage.漫游].OnExitAdd += () => // { // transform.DOMove(pos.position, 2); // transform.DOLocalRotate(pos.localEulerAngles, 2); // }; // GameStageManager.Instance.stageDict[GameStage.展示].OnUpdateAdd += () => // { // if (Input.GetAxis("Mouse ScrollWheel") != 0) // { // flagFloat += Input.GetAxis("Mouse ScrollWheel"); // if (flagFloat >= area.y) // { // flagFloat = area.y; // } // else if (flagFloat <= area.x) // { // flagFloat = area.x; // } // else // { // transform.position += transform.forward * Input.GetAxis("Mouse ScrollWheel"); // } // // // } // }; } public void SetCamera() { flagFloat = 0; } private void Update() { if (Input.GetMouseButton(1) && Input.GetAxis("Mouse X") !=0) { transform.localEulerAngles += Vector3.up * Input.GetAxis("Mouse X"); } } }