标签:mon collect 视角 cto euler date update ram axis
1 using UnityEngine; 2 using System.Collections; 3 4 public class CameraMove : MonoBehaviour 5 { 6 public Transform m_Player; 7 public float m_RotaSpeed = 2; 8 public float m_Slow = 5f; 9 10 private bool m_isAnXia = false; 11 private Vector3 m_xdPos; 12 13 void Start () 14 { 15 m_xdPos = this.transform.position - m_Player.position; 16 } 17 18 void Update () 19 { 20 Move(); 21 Rote(); 22 } 23 24 void Move() 25 { 26 this.transform.position = m_Player.position + m_xdPos; 27 } 28 29 void Rote() 30 { 31 if (Input.GetMouseButtonDown(1)) 32 { 33 m_isAnXia = true; 34 } 35 if (Input.GetMouseButtonUp(1)) 36 { 37 m_isAnXia = false; 38 } 39 if (m_isAnXia) 40 { 41 this.transform.RotateAround(m_Player.position, Vector3.up, Input.GetAxis("Mouse X") * m_RotaSpeed); 42 var pos = this.transform.position; 43 var rota = this.transform.rotation; 44 this.transform.RotateAround(m_Player.position, this.transform.right, Input.GetAxis("Mouse Y") * -m_RotaSpeed); 45 var x = this.transform.eulerAngles.x; 46 if (x < 10 || x > 80) 47 { 48 this.transform.position = pos; 49 this.transform.rotation = rota; 50 } 51 52 m_xdPos = this.transform.position - m_Player.position; 53 } 54 } 55 }
标签:mon collect 视角 cto euler date update ram axis
原文地址:http://www.cnblogs.com/heizai/p/6135499.html