You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.9 KiB
69 lines
1.9 KiB
8 months ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using DG.Tweening;
|
||
|
using UnityEngine;
|
||
|
|
||
|
/// <summary>
|
||
|
/// 相机变换
|
||
|
/// </summary>
|
||
|
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");
|
||
|
}
|
||
|
}
|
||
|
}
|